【发布时间】:2020-11-04 09:44:09
【问题描述】:
这是我的 build.gradle 文件:
plugins {
id 'org.springframework.boot' version '2.3.4.RELEASE'
id 'io.spring.dependency-management' version '1.0.10.RELEASE'
id 'java'
id 'io.freefair.lombok' version '5.0.1'
}
group = 'TidBiT'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '11'
repositories {
mavenCentral()
}
dependencies {
compile "org.springframework.boot:spring-boot-starter-web:2.3.4.RELEASE"
compile 'org.hibernate.javax.persistence:hibernate-jpa-2.1-api:1.0.0.Final'
compile 'org.springframework.boot:spring-boot-configuration-processor'
implementation 'org.springframework.boot:spring-boot-starter'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-validation'
runtimeOnly 'org.postgresql:postgresql'
testImplementation('org.springframework.boot:spring-boot-starter-test') {
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
}
}
test {
useJUnitPlatform()
}
这是我的 gradle-wrapper.properties
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
这是我得到的错误:
* What went wrong:
An exception occurred applying plugin request [id: 'org.springframework.boot', version: '2.3.4.RELEASE']
> Failed to apply plugin [id 'org.springframework.boot']
> Spring Boot plugin requires Gradle 5 (5.6.x only) or Gradle 6 (6.3 or later). The current version is Gradle 6.2.2
我不是 gradle 方面的专家。大多数时候我只是从网上复制和过去的东西,直到一切正常。但是,在我看来,系统正在检测的 gradle 版本与我想要的在 gradle-wrapper.properties 文件中声明的 gradle 版本之间存在不一致。
有人知道我做错了什么吗?
谢谢
【问题讨论】:
-
你是否使用 gradle wrapper 启动你的构建? (gradlew / gradlew.bat)?
-
不,我使用像
gradle clean和gradle bootRun这样的命令
标签: java spring spring-boot gradle