【发布时间】:2018-09-30 15:11:41
【问题描述】:
我有该项目的主要build.gradle 文件
buildscript {
repositories {
jcenter()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${spring_boot_version}")
}
}
def javaProjects = subprojects.findAll {
it.name in ["common", "core", "web", "app"]
}
allprojects {
apply plugin: 'idea'
apply plugin: 'eclipse'
repositories {
jcenter()
}
}
idea {
project {
jdkName = "1.8"
languageLevel = "1.8"
vcs = "Git"
}
}
configure(javaProjects) {
apply plugin: 'java'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'findbugs'
sourceCompatibility = 1.8
targetCompatibility = 1.8
dependencies {
...
}
}
和app 模块的build.gradle 文件,我有一个运行gradle 的配置
apply plugin: 'org.springframework.boot'
dependencies {
...
}
springBoot {
mainClass = "com.web.WebApplication"
}
jar {
manifest {
attributes 'Implementation-Title': "Rest-Web-Services",
'Implementation-Version': "1.0",
'Main-Class': "com.web.WebApplication"
}
}
当构建 gradle 抛出时
FAILURE: Build failed with an exception.
* Where:
Build file '...\REST-Web-Services\app\build.gradle' line: 28
* What went wrong:
A problem occurred evaluating project ':app'.
> Could not set unknown property 'mainClass' for object of type org.springframework.boot.gradle.dsl.SpringBootExtension.
如何设置启动mainClass类?
【问题讨论】:
-
我在使用 Spring 示例代码 here. 时遇到了同样的问题
标签: java spring spring-boot gradle