我正在尝试构建一个基于Spring boot的java项目。我正在使用gradle 4.0构建我遇到以下错误
>
Configure project :
Gradle now uses separate output directories for each JVM language, but this build assumes a single directory for all classes from a source set. This behaviour has been deprecated and is scheduled to be removed in Gradle 5.0
at integrationTest_8n6fy28i1vne67lerit0xfq44$_run_closure2.doCall(/Users/eov537/Documents/workspace-sts-3.9.0.RELEASE/hello-world-service/gradle/integrationTest.gradle:15)
The setTestClassesDir(File) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use the setTestClassesDirs(FileCollection) method instead.
at integrationTest_8n6fy28i1vne67lerit0xfq44$_run_closure2.doCall(/Users/eov537/Documents/workspace-sts-3.9.0.RELEASE/hello-world-service/gradle/integrationTest.gradle:15)
FAILURE: Build failed with an exception.
* Where:
Script '/Users/eov537/Documents/workspace-sts-3.9.0.RELEASE/hello-world-service/gradle/sonar.gradle' line: 3
* What went wrong:
A problem occurred evaluating script.
> org/gradle/listener/ActionBroadcast
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
* Get more help at https://help.gradle.org
gradle集成测试配置是单独目录所需的更改。
// Integration Tests
sourceSets {
integrationTest {
java.srcDir file('src/integrationtest/java')
java.exclude '**/docs/*.java'
resources.srcDir file('src/integrationtest/resources')
compileClasspath = sourceSets.main.output + configurations.testRuntime
runtimeClasspath = output + compileClasspath
}
}
task integrationTest(type: Test) {
description = 'Runs the integration tests'
group = 'verification'
testClassesDir = sourceSets.integrationTest.output.classesDir
classpath = sourceSets.integrationTest.runtimeClasspath
reports.junitXml.destination = file("$reports.junitXml.destination/integration")
}
sonar.gradle如下
// Sonar
apply plugin: "org.sonarqube"
sonarqube {
properties {
property "sonar.projectKey", "${project.name}"
property "sonar.projectName", "${project.name}"
property "sonar.projectVersion", "${extended_version}"
property "sonar.host.url", "https://sonar-rdt.kdc.capitalone.com"
property "sonar.jacoco.itReportPath", "build/jacoco/integrationTest.exec"
property "sonar.exclusions", "**/model/**/*.java, **/Application.java"
property "sonar.junit.reportsPath", test.reports.junitXml.destination
}
}