Gradle Release Notes
Version 5.2.1
The Gradle team is excited to announce Gradle 5.2.
This release features a newJava Platform plugin,improved C++ plugins,new C++ project types forgradle init
,service injection into plugins and project extensions,Kotlin DSL 1.1.3 and more.
Read theGradle 5.x upgrade guide to learn about breaking changes and considerations for upgrading from Gradle 5.0. If upgrading from Gradle 4.x, please readupgrading from Gradle 4.x to 5.0 first. Users upgrading from 5.1 should not have to worry about breaking changes.
We would like to thank the following community contributors to this release of Gradle:
Thomas Broyer,Szczepan Faber,Stefan M.,Kim Brouer,Roberto Perez Alcolea,Ian Kerins,Josh Soref,Andrew Nessin,NFM,Jean-Michel Fayard,Arun Ponniah Sethuramalingam,Victor Jacobs,Theodore Ni,Sam Holmes,Artem Zinnatullin,Ronald Brindl, andRichard Newton.
NOTE: Gradle 5.2 has had one patch release. You should use the latest patch release (5.2.1).
Upgrade Instructions
Switch your build to use Gradle 5.2.1 by updating your wrapper properties:
./gradlew wrapper --gradle-version=5.2.1
Standalone downloads are available atgradle.org/releases.
The Java Platform plugin
This release features theJava Platform plugin, which allows you to declare a platform. Like Maven BOMs, platforms can be used to define a set of versions for dependencies that are known to work together. These versions can be published and consumed elsewhere as dependency recommendations.
Read theJava Platform plugin section of the userguide for more details.
Building native software with Gradle
See more information about theGradle native project.
Recommend C++ projects use new C++ plugins
We introducednew C++ plugins last year that are more feature rich and familiar to Gradle users.
In this release, we are recommending new C++ projects use these plugins overthe existing software model plugins. The new plugins do not currently support C, Objective-C or Objective-C++ out of the box, but they havea lot of other things to offer.
Build Init can now generate C++ sample projects
If you want to get started quickly with a C++ project, try runninggradle init
and following the instructions to generate a sample C++ application or library. You'll notice that the projects will be generated with thecpp-application
orcpp-library
plugins instead of thecpp
plugin. This is now the recommended approach when starting new projects.
Support for additional Windows native toolchains
In previous versions of Gradle, native builds using GCC withcygwin64 ormingw64 was reported to work, but was not officially supported. These toolchains are now officially supported by Gradle. Seethe userguide for more information about supported native toolchains.
Support for testing applications on Windows
Gradle now automatically hides themain
symbol when building native applications, so applications can be tested on Windows like they already were on macOS and Linux.
Contributed byRichard Newton.
Improvements for custom task authors
Service injection into plugins and project extensions
There are severaluseful services that Gradle makes available for task and plugin implementations to use. Previously, these were available for injection into task and plugin instances. In this Gradle release these services are also available for injection directly into project extensions. Services are also now available for injection into the elements of a container created using theproject.container(Class)
method. Using this feature can help simplify your plugin implementation.
Services can be injected into an instance either as constructor parameters or using a property getter method. In this release both options are available for all types for which service injection is available. In previous Gradle versions, using a property getter method was not supported for plugin types.
See the user manual sections onservice injection for plugins andservice injection into tasks for details.
Support for setting environment variables when using Gradle TestKit
GradleTestKit based tests can now specify environment variables viaGradleRunner
. These environment variables will be visible to the build under test.
Contributed bySzczepan Faber.
Maven publication can expose resolved versions
When using themaven-publish
plugin, you can now opt-in to publish theresolved dependency versions instead of thedeclared ones. For details, have a look at thededicated section in the plugin documentation.
Rich console improvements on Windows
This release includes some improvements to Gradle's console integration on Windows. Gradle now detects when it is running from Mintty on Windows and enables the rich console. Mintty is a popular terminal emulator used by projects such as Cygwin and Git for Windows.
The implementation of the rich console has been improved to remove some distracting visual artifacts on Windows.
Annotation processor improvements
Sources generated by annotation processors are now put in a separate directory by default, which means they will no longer pollute your production jar file.
Due to a bug in javac, users would often get warnings about unrecognized processor options during incremental compilation, because the corresponding processor did not need to run. This warning is now fixed and will only appear if an option is really unrecognized.
Contributed byThomas Broyer.
JavaExec
tasks track the version of Java used
Tasks that useJavaExec
now track the version of Java used instead of the absolute path to thejava
executable.
Contributed byTheodore Ni.
Promoted features
Promoted features are features that were incubating in previous versions of Gradle but are now supported and subject to backwards compatibility. See the User manual section on the “Feature Lifecycle” for more information.
The following are the features that have been promoted in this Gradle release.
Known issues
Known issues are problems that were discovered post release that are directly related to changes made in this release.
Deprecations
Features that have become superseded or irrelevant due to the natural evolution of Gradle becomedeprecated, and scheduled to be removed in the next major Gradle version (Gradle 6.0). See the User Manual section on the “Feature Lifecycle” for more information.
The following are the newly deprecated items in this Gradle release. If you have concerns about a deprecation, please raise it via theGradle Forums.
ProjectBuilder
constructor
The default constructor ofProjectBuilder
is now deprecated. You should always useProjectBuilder#builder()
to create instances.
Breaking changes
See theGradle 5.x upgrade guide to learn about breaking changes and considerations for upgrading from Gradle 5.x.
External contributions
We love getting contributions from the Gradle community. For information on contributing, please seegradle.org/contribute.
Reporting Problems
If you find a problem with this release, please file a bug onGitHub Issues adhering to our issue guidelines. If you're not sure you're encountering a bug, please use theforum.
We hope you will build happiness with Gradle, and we look forward to your feedback viaTwitter or onGitHub.