gpt4 book ai didi

java - Spring Boot插件需要Gradle 4.10或更高版本。当前版本是Gradle 4.1

转载 作者:行者123 更新时间:2023-12-01 11:00:52 26 4
gpt4 key购买 nike

我有一个Spring Gradle项目。我正在尝试使用gradle build命令进行构建。但是出现以下错误:

* Where:
Build file 'F:\MyProjectName\build.gradle' line: 2

* What went wrong:
An exception occurred applying plugin request [id: 'org.springframework.boot', version: '2.2.2.RELEASE']
> Failed to apply plugin [id 'org.springframework.boot']
> Spring Boot plugin requires Gradle 4.10 or later. The current version is Gradle 4.1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

* Get more help at https://help.gradle.org

BUILD FAILED in 1s

但是我已经在使用 gradle-5.6.4 了。并且还尝试了最新的 gradle-6.0.1-bin ,但出现了相同的错误。

gradle-wrapper.properties
#Wed Dec 04 12:51:57 IST 2019
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME

build.gradle
plugins {
id 'org.springframework.boot' version '2.2.1.RELEASE'
id 'io.spring.dependency-management' version '1.0.8.RELEASE'
id 'java'
}

group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'

repositories {
mavenCentral()
}

dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-mongodb-reactive'
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'io.jsonwebtoken:jjwt:0.9.1'
implementation 'org.springframework.security:spring-security-jwt:1.0.7.RELEASE'
implementation 'org.springframework.security.oauth:spring-security-oauth2:2.4.0.RELEASE'
implementation 'de.mkammerer:argon2-jvm:2.6'

compileOnly 'org.projectlombok:lombok:1.18.10'
annotationProcessor 'org.projectlombok:lombok:1.18.10'

testImplementation('org.springframework.boot:spring-boot-starter-test') {
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
}
testImplementation 'io.projectreactor:reactor-test'
testImplementation 'org.springframework.security:spring-security-test'
}

jar {
enabled true
}

test {
useJUnitPlatform()
}

怎么解决呢?提前致谢。

最佳答案

如果您使用的是gradle build命令,则说明您没有使用包装器,因此也没有使用包装器属性中配置的gradle版本。您正在使用计算机上安装的全局gradle版本。

要使用gradle包装器,请使用

./gradlew build

或者,在Windows上
.\gradlew.bat build

在您的项目根文件夹中。

Documentation

关于java - Spring Boot插件需要Gradle 4.10或更高版本。当前版本是Gradle 4.1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59477820/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com