springboot gradle 使用过程中遇到的问题小结(2)

2019-07-11 10:50:50 浏览数 (1)

想要打包api层,然后出现错误:

Plugin request for plugin already on the classpath must not include a version

新建的项目中默认的build.gradle中是:

代码语言:javascript复制
id 'org.springframework.boot' version '2.1.6.RELEASE'

可以修改为:

代码语言:javascript复制
buildscript {
    ext {
        springBootVersion = '2.1.6.RELEASE'
    }
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
    }
}

plugins {
//    id 'org.springframework.boot' version '2.1.6.RELEASE'
    id 'java'
}

apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'

即可解决问题

0 人点赞