Upgrading your build from Gradle 5.x
This chapter provides the information you need to migrate your Gradle 5.x builds to Gradle 5.1.1. For migrating from Gradle 4.x, complete the 4.x to 5.0 guide first.
We recommend the following steps for all users:
gradle help --scanand view the deprecations view of the generated 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=allto see the deprecations in the console, though it may not report as much detailed information.
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.
gradle wrapper --gradle-version 5.1.1to update the project to 5.1.1.
Try to run the project and debug any errors using the Troubleshooting Guide.
The following changes were not previously deprecated:
Input and output files of
Sign tasks are now tracked via
In Gradle 5.0, the collection property instances created using
ObjectFactory would have no value defined, requiring plugin authors to explicitly set an initial value. This proved to be awkward and error prone so
ObjectFactory now returns instances with an empty collection as their initial value.
Since JDK 11 no longer supports changing the working directory of a running process, setting the working directory of a worker via its fork options is now prohibited. All workers now use the same working directory to enable reuse. Please pass files and directories as arguments instead. See examples in the Worker API documentation.
To expand our idiomatic Provider API practices, the install name property from
org.gradle.nativeplatform.tasks.LinkSharedLibrary is affected by this change.
getInstallName()was changed to return a
setInstallName(String)was removed. Use
To expand our idiomatic Provider API practices, the
WindowsResourceCompile task has been converted to use the Provider API.
Passing additional compiler arguments now follow the same pattern as the
CppCompile and other tasks.
The list of
beforeResolve actions are no longer shared between a copied configuration and the original.
Instead, a copied configuration receives a copy of the
beforeResolve actions at the time the copy is made.
beforeResolve actions added after copying (to either configuration) will not be shared between the original and the copy.
This may break plugins that relied on the previous behaviour.
The type of
MavenPomDeveloper.propertieshas changed from
The type of
MavenPomContributor.propertieshas changed from
operatingSystems property on native components has been replaced with the targetMachines property.
AbstractArchiveTask has several new properties using the [Provider API](userguide/lazy_configuration.html). Plugins that extend these types and override methods from the base class may no longer behave the same way. Internally,
AbstractArchiveTask prefers the new properties and methods like
getArchiveName() are façades over the new properties.
If your plugin/build only uses these types (and does not extend them), nothing has changed.
Follow the API links to learn how to deal with these deprecations (if no extra information is provided here):