Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 几个带渐变和弹簧的模块_Java_Spring_Spring Boot_Gradle - Fatal编程技术网

Java 几个带渐变和弹簧的模块

Java 几个带渐变和弹簧的模块,java,spring,spring-boot,gradle,Java,Spring,Spring Boot,Gradle,我正在尝试使用Spring boot插件清理构建项目,并得到以下消息: 任务“:讲师05:findMainClass”的执行失败。 无法从以下候选对象中找到单个主类[ru.atom.boot.mm.MatchMakerApp,ru.atom.boot.hw.HelloSpringBoot] 我找不到关于这个案子的任何信息。我发现了几个问题,比如,但这是给maven的。如何正确配置我的项目? 我想补充一下 bootRepackage { mainClass = 'ru.atom.boot.

我正在尝试使用Spring boot插件清理构建项目,并得到以下消息:

任务“:讲师05:findMainClass”的执行失败。 无法从以下候选对象中找到单个主类[ru.atom.boot.mm.MatchMakerApp,ru.atom.boot.hw.HelloSpringBoot]

我找不到关于这个案子的任何信息。我发现了几个问题,比如,但这是给maven的。如何正确配置我的项目?
我想补充一下

bootRepackage {
    mainClass = 'ru.atom.boot.mm.MatchMakerApp'
}
build.gradle

我的根项目:

plugins {
id 'org.springframework.boot' version '1.5.8.RELEASE'
id 'com.github.kt3k.coveralls' version '2.6.3'
}

bootRepackage {
mainClass = 'ru.atom.boot.mm.MatchMakerApp'
}

ext {
jdkVersion = 1.9

jettyVersion = "9.4.7.v20170914"
junitVersion = "4.12"
jacksonVersion = "2.9.1"
log4jVersion = "2.7"
jetbrainsAnnotationVersion = "15.0"
okhttpVersion = "3.6.0"
jerseyVersion = "2.26"
gsonjVersion = "2.7"
postgresVersion = "9.4-1200-jdbc41"
jetbrainsAnnotationVersion = "15.0"
hibernateVersion = "5.2.3.Final"
websocketVersion = "9.4.3.v20170317"
jolVersion = "0.8"
}

allprojects {
group = "technoatom"
version = "1.0-SNAPSHOT"

apply plugin: 'java'
apply plugin: 'org.springframework.boot'
apply plugin: 'checkstyle'
apply plugin: 'jacoco'

repositories {
    mavenCentral()
}

sourceCompatibility = jdkVersion
targetCompatibility = jdkVersion
}

subprojects {
checkstyle {
    ignoreFailures = false
    toolVersion = '7.5'
    configFile = rootProject.file('config/checkstyle/checkstyle.xml')
}

tasks.withType(Checkstyle) {
    reports {
        xml.enabled false
        html.destination 
"$rootProject.buildDir/report/${project.name}.html"
        html.stylesheet 
resources.text.fromFile(rootProject.file('config/checkstyle/checkstyle-custom.xsl'))
    }
}

}

ext.libraries = [
    spring_boot : [
        "org.springframework.boot:spring-boot-starter-web",
        "org.springframework.boot:spring-boot-starter-actuator"
    ],

    spring_boot_test : "org.springframework.boot:spring-boot-starter-test",

    jetty_server : "org.eclipse.jetty:jetty-server:$jettyVersion",
    jetty_servlet: "org.eclipse.jetty:jetty-servlet:$jettyVersion",
    junit: "junit:junit:$junitVersion",
    log4j: [
        "org.apache.logging.log4j:log4j-api:$log4jVersion",
        "org.apache.logging.log4j:log4j-core:$log4jVersion"
    ],
    jetbrainsAnnotations: "org.jetbrains:annotations:$jetbrainsAnnotationVersion",
    okhttp: "com.squareup.okhttp3:okhttp:$okhttpVersion",
    jersey_server: "org.glassfish.boot.core:boot-server:$jerseyVersion",
    jersey_hk2: "org.glassfish.boot.inject:boot-hk2:$jerseyVersion",
    jersey_containers: "org.glassfish.boot.containers:boot-container-servlet:$jerseyVersion",
    jersey_test:
            "org.glassfish.boot.test-framework.providers:boot-test-framework-provider-grizzly2:$jerseyVersion",
    gson: "com.google.code.gson:gson:$gsonjVersion",
    postgres: "org.postgresql:postgresql:$postgresVersion",
    hibernate: "org.hibernate:hibernate-core:$hibernateVersion",
    websocketclient: "org.eclipse.jetty.websocket:websocket-client:$websocketVersion",
    websocketserver: "org.eclipse.jetty.websocket:websocket-server:$websocketVersion",
    websocketapi: "org.eclipse.jetty.websocket:websocket-api:$websocketVersion",
    jackson: "com.fasterxml.jackson.core:jackson-databind:$jacksonVersion",
    jol: "org.openjdk.jol:jol-core:$jolVersion",
    jol_samples: "org.openjdk.jol:jol-samples:$jolVersion"
]

jacocoTestReport {
additionalSourceDirs = 
files(subprojects.sourceSets.main.allSource.srcDirs)
sourceDirectories = 
files(subprojects.sourceSets.main.allSource.srcDirs)
classDirectories = files(subprojects.sourceSets.main.output)
executionData = files(subprojects.jacocoTestReport.executionData)
onlyIf = {
    true
}

reports {
        xml.enabled = true
        html.enabled = true
}
doFirst {
    executionData = files(executionData.findAll {
        it.exists()
    })
}
}

coveralls {
sourceDirs = 

files(subprojects.sourceSets.main.allSource.srcDirs).files.absolutePath
}
子项目,我正在尝试构建,它有两个主要类:

dependencies {
compile rootProject.libraries.spring_boot
compile rootProject.libraries.log4j


testCompile rootProject.libraries.junit
testCompile rootProject.libraries.spring_boot_test
}

sourceSets {
main {
    java {
        srcDirs = ['src/main/java']
    }
}
test {
    java {
        srcDirs = ['src/test/java']
    }
}
}

尝试将其替换为:

springBoot {
    mainClass = 'ru.atom.boot.mm.MatchMakerApp'
}

如前所述,您可以在Spring Boot plugin中阅读更多内容

pom文件中的起始类是什么?还是在org.springframework.boot插件中定义主类?@jprismupdated@jprism这就是我试图定义的主要内容class@jprism实际上,我现在要添加build.gradle。Try:springBoot{mainClass='ru.atom.boot.mm.MatchMakerApp'}