This chapter provides the information you need to migrate your Gradle 9.x builds to the latest Gradle release. For migrating from Gradle 4.x, 5.x, 6.x, 7.x, or 8.x see the older migration guide first.

We recommend the following steps for all users:

  1. Try running gradle help --scan and view the deprecations view of the generated Build Scan.

    Deprecations View of a Gradle Build Scan

    This lets you see any deprecation warnings that apply to your build.

    Alternatively, you can run gradle help --warning-mode=all to see the deprecations in the console, though it may not report as much detailed information.

  2. Update your plugins.

    Some plugins will break with this new version of Gradle because they use internal APIs that have been removed or changed. The previous step will help you identify potential problems by issuing deprecation warnings when a plugin tries to use a deprecated part of the API.

  3. Run gradle wrapper --gradle-version 9.1.0-branch-sigushkinDeclarativeComposabilitySpikeFromGh-20250805133820+0000 to update the project to 9.1.0-branch-sigushkinDeclarativeComposabilitySpikeFromGh-20250805133820+0000.

  4. Try to run the project and debug any errors using the Troubleshooting Guide.

Upgrading from 9.0 and earlier

Deprecations

Deprecated multi-string dependency notation

In an effort to simplify and standardize the Gradle API, the multi-string dependency notation has been deprecated and will no longer be permitted in Gradle 10. Gradle will primarily accept dependency declarations in the form of a single string, with each dependency coordinate separated by a colon.

Below are examples of the deprecated multi-string notation:

build.gradle.kts
dependencies {
    implementation(group = "org", name = "foo", version = "1.0")
    implementation(group = "org", name = "foo", version = "1.0", configuration = "conf")
    implementation(group = "org", name = "foo", version = "1.0", classifier = "classifier")
    implementation(group = "org", name = "foo", version = "1.0", ext = "ext")
}

testing.suites.named<JvmTestSuite>("test") {
    dependencies {
        implementation(module(group = "org", name = "foo", version = "1.0"))
    }
}
build.gradle
dependencies {
    implementation(group: 'org', name: 'foo', version: '1.0')
    implementation(group: 'org', name: 'foo', version: '1.0', configuration: 'conf')
    implementation(group: 'org', name: 'foo', version: '1.0', classifier: 'classifier')
    implementation(group: 'org', name: 'foo', version: '1.0', ext: 'ext')
}

testing.suites.test {
    dependencies {
        implementation(module(group: 'org', name: 'foo', version: '1.0'))
    }
}

These declarations should be replaced with the single-string notation:

build.gradle.kts
dependencies {
    implementation("org:foo:1.0")
    implementation("org:foo:1.0") {
        targetConfiguration = "conf"
    }
    implementation("org:foo:1.0:classifier")
    implementation("org:foo:1.0@ext")
}

testing.suites.named<JvmTestSuite>("test") {
    dependencies {
        implementation("org:foo:1.0")
    }
}
build.gradle
dependencies {
    implementation("org:foo:1.0")
    implementation("org:foo:1.0") {
        targetConfiguration = "conf"
    }
    implementation("org:foo:1.0:classifier")
    implementation("org:foo:1.0@ext")
}

testing.suites.test {
    dependencies {
        implementation("org:foo:1.0")
    }
}

In some cases, a complete single-string notation may not be known up front. Instead of concatenating the coordinates into a new string, it is possible to use a DependencyFactory to create Dependency instances directly from the individual components:

build.gradle.kts
val group = "org"
val artifactId = "foo"
val version = "1.0"

configurations.dependencyScope("implementation") {
    dependencies.add(project.dependencyFactory.create(group, artifactId, version))
}
build.gradle
def group = "org"
def artifactId = "foo"
def version = "1.0"

configurations.dependencyScope("implementation") {
    dependencies.add(project.dependencyFactory.create(group, artifactId, version))
}

Deprecation of ReportingExtension.file(String)

The file() method on ReportingExtension has been deprecated and will be removed in Gradle 10.0.0.

Use ReportingExtension.getBaseDirectory() with file(String) or dir(String) instead.

Deprecation of ReportingExtension.getApiDocTitle()

The getApiDocTitle() method on ReportingExtension has been deprecated and will be removed in Gradle 10.0.0.

There is no direct replacement for this method.

Deprecation of the archives configuration

The archives configuration added by the base plugin has been deprecated and will be removed in Gradle 10.0.0. Adding artifacts to the archives configuration will now result in a deprecation warning. If you want the artifact built when running the assemble task, you should add the artifact (or the task that produces it) as a dependency of the assemble task directly.

build.gradle.kts
val specialJar = tasks.register<Jar>("specialJar") {
    archiveBaseName.set("special")
    from("build/special")
}

tasks.named("assemble") {
    dependsOn(specialJar)
}

The Configuration.visible property is now deprecated

Prior to Gradle 9.0, any configuration with isVisible() returning true would have its artifacts built automatically when the assemble task was executed. This implicit behavior was removed in 9.0.0, and the Configuration.visible property no longer has any meaningful effect. This property is now deprecated and will be removed in Gradle 10.0.0. Any usage of visible can be removed. If you want the artifacts of a configuration to be built as part of the assemble task, add an explicit task dependency on assemble instead:

build.gradle.kts
val specialJar = tasks.register<Jar>("specialJar") {
    archiveBaseName.set("special")
    from("build/special")
}

configurations {
    consumable("special") {
        outgoing.artifact(specialJar)
    }
}

tasks.named("assemble") {
    dependsOn(specialJar)
}

Non-String project properties in GradleBuild task

The GradleBuild task now deprecates using non-String values in startParameter.projectProperties. While the type is declared as Map<String, String>, there was no strict enforcement, allowing non-String values to be set. This deprecated behavior will be removed in Gradle 10.0.0.

If you are using non-String values in project properties, convert them to String representation:

build.gradle.kts
val myIntProp = 42

tasks.register<GradleBuild>("nestedBuild") {
    startParameter.projectProperties.put("myIntProp", "$myIntProp") // Convert int to String
}
build.gradle
def myIntProp = 42

tasks.register('nestedBuild', GradleBuild) {
    startParameter.projectProperties.put('myIntProp', "$myIntProp") // Convert int to String
}