Gradle 8 fails on Report destination: switch to outputLocation
What went wrong: 'java.io.File org.gradle.api.reporting.ConfigurableReport.getDestination()'Short answer
Gradle 8.0 removed the deprecated destination and enabled properties of the Report type. A build script that still sets them, or a plugin compiled against the old API such as an old SonarQube plugin, fails with a getDestination error. Set outputLocation and required in your script, and upgrade the plugin.
Fix it fast
1Find out which cause you have
Run the build with a stack trace. The first frames show whether your own build script or a plugin calls the removed method.
./gradlew help --stacktrace2Match what you see, then jump to its fix
What does the error look like?
What went wrong: 'java.io.File org.gradle.api.reporting.ConfigurableReport.getDestination()'
Cause 1 of 2
A plugin built for Gradle 7 is still applied
1Check
The SonarScanner for Gradle release history lists support for Gradle 8 from 4.0.0.2929, and Gradle 9 from 7.0.0.6105. An older plugin version calls the removed method.
grep -rn 'sonarqube' build.gradle* settings.gradle* gradle/libs.versions.toml2Fix
Raise the plugin to a version that supports your Gradle version. Use the latest scanner version listed in the docs.
plugins {
id("org.sonarqube") version "<latest version from the docs>"
}3Verify
Configuration finishes without the error.
./gradlew helpConfirmed by docs.sonarsource.com
Cause 2 of 2
Your own script sets report.destination or enabled
1Check
The Gradle 8.0 upgrade notes say the destination and enabled properties of the Report type were removed. Setting them was already deprecated since 7.x.
grep -rn -E 'destination|\.enabled|setDestination' build.gradle* */build.gradle*2Fix
Use outputLocation and required instead.
tasks.withType<Test> {
reports.junitXml.outputLocation = layout.buildDirectory.dir("reports/my-report")
reports.html.required = false
}3Verify
Run the task that produces the report.
./gradlew testConfirmed by docs.gradle.org
How do I stop it coming back?
- Run builds with --warning-mode all before upgrading Gradle, so deprecations show up while they still work.
- Upgrade third-party Gradle plugins in the same change as the wrapper.
- Read the upgrade guide for the next major Gradle version before bumping it.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
Related fixes
Mobile apps
Gradle says deprecated features were used and the build will break on the next major version
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
This is a warning, not a failure.
3 causes, each with a fixBack end
Android gets HTML instead of JSON from a PHP API
org.json.JSONException: Value <br of type java.lang.String cannot be converted to JSONObject
The response body is not JSON.
2 causes, each with a fixBack end
Gradle runs no Cucumber scenarios from my feature files
Feature files exist under src/test but nothing runs
Cucumber runs on the JUnit Platform, so Gradle must call useJUnitPlatform() and have the cucumber-junit-platform-engine on the test classpath.
4 causes, each with a fixBack end
A Gradle build fails on classes that use Lombok annotations
Error: Annotation processors must be explicitly declared now.
Lombok is two things for Gradle: a compile-time library and an annotation processor.
3 causes, each with a fixBack end
IntelliJ IDEA compiles with a JDK that does not know Java 17
Invalid source release: 17
The compiler that IntelliJ or Gradle starts is older than Java 17, but the project asks for Java 17 source.
3 causes, each with a fixBack end
A scanner flags jackson-databind: how to upgrade it in Gradle
jackson-databind vulnerability reported by a dependency scanner
Find where the old jackson-databind comes from, then raise it.
3 causes, each with a fix