This chapter provides the information you need to migrate your Gradle 6.x builds to the latest Gradle release. For migrating from Gradle 4.x or 5.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 is so that you can see any deprecation warnings that apply to your build.

    Alternatively, you could 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, for example 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 does try to use a deprecated part of the API.

  3. Run gradle wrapper --gradle-version 6.1-milestone-1 to update the project to 6.1-milestone-1.

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

Upgrading from 6.0 and earlier

Deprecations

Query a mapped task output property before the task has completed

It is now deprecated to query the value of a mapped task output property before the task has completed. Here is an example of this case, where a task’s output file is parsed to produce an Integer and the result used as input to another task:

class TaskA: DefaultTask {
    @Input
    final Property<Integer> threadPoolSize = ...
}

class TaskB: DefaultTask {
    @OutputFile
    final RegularFileProperty outputFile = ...
}

taskA.threadPoolSize = taskB.outputFile.map { it.text.toInteger() }

In this case, calling get(), or any other query method, on taskA.threadPoolSize will produce a deprecation warning if done prior to taskB completing, as the file has not yet been generated. This will become an error in Gradle 7.0

Potential breaking changes

No potential breaking changes were introduced.