我尝试创建spring引导应用程序:
我从https://start.spring.io/中选择了我需要的组件
现在我想构建这个应用程序,它会掉下来:
FAILURE: Build failed with an exception.
* Where:
Settings file 'D:\objectsharingsystem\settings.gradle' line: 2
* What went wrong:
A problem occurred evaluating settings 'object-sharing-system'.
> Failed to apply plugin [id 'org.gradle.java']
> org.gradle.initialization.DefaultSettings_Decorated cannot be cast to org.gradle.api.internal.project.ProjectInternal
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILEDsettings.gradle:
rootProject.name = 'object-sharing-system'
apply plugin: 'java'
compileJava {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}build.gradle:
buildscript {
ext {
springBootVersion = '2.0.0.BUILD-SNAPSHOT'
}
repositories {
mavenCentral()
maven { url "https://repo.spring.io/snapshot" }
maven { url "https://repo.spring.io/milestone" }
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}
apply plugin: 'java'
apply plugin: 'org.springframework.boot'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = 1.8
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('org.springframework.boot:spring-boot-starter-jdbc')
compile('org.springframework.boot:spring-boot-starter-security')
compile('org.springframework.boot:spring-boot-starter-validation')
compile('org.springframework.boot:spring-boot-starter-web')
runtime('com.microsoft.sqlserver:mssql-jdbc')
testCompile('org.springframework.boot:spring-boot-starter-test')
}请帮忙找出错误。
发布于 2017-03-22 14:04:22
settings.gradle不能处理Project级插件的应用。
从apply plugin和compileJava中删除settings.gradle。您已经将sourceCompatibility设置为build.gradle
发布于 2017-03-22 14:01:37
见这里,上面写着
将设置文件中的方法调用委托给设置对象。有关更多信息,请查看API文档中的Settings类。
与build.gradle不同,settings.gradle中的apply方法需要Plugin<Settings>而不是Plugin<Project>。java插件是一个Plugin<Project>,不能像这样在settings.gradle中应用
https://stackoverflow.com/questions/42953816
复制相似问题