gpt4 book ai didi

spring-boot - 编译发现gradle的错误版本

转载 作者:行者123 更新时间:2023-12-03 12:24:18 24 4
gpt4 key购买 nike

我使用spring boot2。在一个多Java项目中。

我尝试构建我的主库(尚无Java文件)

apply plugin: 'java-library-distribution'


plugins {
id 'org.springframework.boot' version '2.0.0.M7'
}

repositories {
mavenCentral()
maven { url "https://repo.spring.io/snapshot" }
maven { url "https://repo.spring.io/milestone" }
}


dependencies {
compile group: 'org.springframework.boot', name: 'spring-boot-starter-data-jpa', version: '2.0.0.M7'
compile group: 'org.postgresql', name: 'postgresql', version: '42.1.4'
testCompile group: 'org.springframework.boot', name: 'spring-boot-starter-test', version: '2.0.0.M7'
}

distributions {
main{
baseName = 'common-model'
}
}

sourceCompatibility = 1.8

tasks.withType(JavaCompile) {
options.compilerArgs = ["-Xlint:unchecked", "-Xlint:deprecation", "-parameters"]
}

在我的gradle/包装器中,我有
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.2-bin.zip

我得到的错误

caused by: org.gradle.api.internal.plugins.PluginApplicationException: Failed to apply plugin [id 'org.springframework.boot']

Caused by: org.gradle.api.GradleException: Spring Boot plugin requires Gradle 4.0 or later. The current version is Gradle 2.13



我找不到任何2.13版本

在我的主要项目中,我有
buildscript {
ext {
springBootVersion = '2.0.0.M7'
}
repositories {
mavenCentral()
maven { url "https://repo.spring.io/snapshot" }
maven { url "https://repo.spring.io/milestone" }
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}

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

mainClassName = 'com.zirgon.EmailApplication'

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

tasks.withType(JavaCompile) {
options.compilerArgs = ["-Xlint:unchecked", "-Xlint:deprecation", "-parameters"]
}

repositories {
mavenCentral()
maven { url "https://repo.spring.io/snapshot" }
maven { url "https://repo.spring.io/milestone" }
}


dependencies {
compile('org.springframework.boot:spring-boot-starter-data-jpa')

compile project(':common-model')
compile('org.springframework.boot:spring-boot-starter-mail')

compile group: 'org.postgresql', name: 'postgresql', version: '42.1.4'
testCompile('org.springframework.boot:spring-boot-starter-test')
}

最佳答案

您可能正在使用本地安装的gradle而不是使用包装器来构建项目,即使用gradle build而不是./gradlew build

关于spring-boot - 编译发现gradle的错误版本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47764787/

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