I have upgraded a repo from Gradle 7.5 to Java 8.5 (running on Java 17 for now)
After the upgrade, the repo still builds fine locally, but started to fail in the deployed build (AWS CodeBuild) with the followiing error:
FAILURE: Build failed with an exception.
- What went wrong: ‘java.io.File org.gradle.api.tasks.testing.JUnitXmlReport.getDestination()’
I understand that the ‘destination’ property has changed to ‘outputLocation’ in Gradle 8.x, however I did not currently have any direct references to ‘destination’ in my existing config, that could be changed to ‘outputLocation’. Nor did I have any direct references to the JUnitXmlReport in my existing config. The relevant section of the existing gradle.build file is simply:
jacoco {
toolVersion = '0.8.8'
}
jacocoTestReport {
reports {
xml.required = true
html.required = true
}
}
test {
useJUnitPlatform() {
includeEngines 'junit-vintage'
includeEngines 'spock'
}
finalizedBy jacocoTestReport // report is always generated after tests run
}
test.dependsOn copyNativeDeps
test.doFirst {
systemProperty "java.library.path", 'build/libs'
}
Any help with the appropriate configuration to fix this problem greatly appreciated
1
I’d try and explicitly update and assign a path:
jacoco {
toolVersion = '0.8.8'
}
jacocoTestReport {
reports {
xml {
required = true
outputLocation = file("$buildDir/reports/jacoco/test/jacocoTestReport.xml") // Set output location explicitly
}
html {
required = true
destination = file("$buildDir/reports/jacoco/test/html") // For HTML report
}
}
}
test {
useJUnitPlatform() {
includeEngines 'junit-vintage'
includeEngines 'spock'
}
finalizedBy jacocoTestReport // report is always generated after tests run
}
test.dependsOn copyNativeDeps
test.doFirst {
systemProperty "java.library.path", 'build/libs'
}
Max Culley is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.