【发布时间】:2020-05-18 00:33:47
【问题描述】:
我正在尝试运行 spring-boot 项目。我对gradle有一些问题。
gradle 构建工作正常,但我无法运行 gradlew
无法运行命令:
./gradlew build &&java -jar build/libs/gs-spring-boot-docker-0.1.0.jar
这里是错误:
Failed to apply plugin [id 'org.springframework.boot']
Spring Boot plugin requires Gradle 4.10 or later. The current version is Gradle 4.9
我的 gradle 版本 6.0
我的 gradle 文件
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:2.2.4.RELEASE")
classpath('com.google.cloud.tools.jib:com.google.cloud.tools.jib.gradle.plugin:1.8.0')
}
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'com.google.cloud.tools.jib'
bootJar {
baseName = 'gs-spring-boot-docker'
version = '0.1.0'
}
repositories {
mavenCentral()
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
dependencies {
compile("org.springframework.boot:spring-boot-starter-web")
implementation('org.springframework.boot:spring-boot-starter-data-jpa')
implementation('org.springframework.boot:spring-boot-starter-web')
implementation('org.postgresql:postgresql')
testCompile("org.springframework.boot:spring-boot-starter-test")
}
gradle build 工作正常,没有错误。
【问题讨论】:
-
项目是否使用了 gradle-wrapper?如果是这样:可能是 gradle-wrapper 使用 gradle-version 4.9 吗?
-
@Turing85 我不知道如何检查它。我试过
$ gradle wrapper --version它显示了我 gradle 6 -
进入项目根目录,执行
./gradlew --version(或Windows上的gradlew.bat --version)。
标签: java spring-boot ubuntu gradle