我想运行一个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构建正常,没有错误。
$ gradle wrapper --version
它显示 gradle 6。 - DoctorDo./gradlew --version
(Windows 上为gradlew.bat --version
)。 - Turing85