Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Node.js, PHP and APIs

Gradle 8 fails on Report destination: switch to outputLocation

ErrorWhat 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.

  • Applies to Gradle 8.x and 9.x, org.sonarqube plugin 4.x and newer
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 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 --stacktrace
  2. 2Match what you see, then jump to its fix

    1. 1The stack trace points into a plugin class (for example org.sonarqube), not into your build fileA plugin built for Gradle 7 is still appliedFix
    2. 2The stack trace or the line reference points at your build.gradleYour own script sets report.destination or enabledFix

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.toml

2Fix

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 help

Confirmed by docs.sonarsource.com

Did this fix it?

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 test

Confirmed by docs.gradle.org

Did this fix it?

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

Back 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 fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.