Gradle 5.2 arrives with a new Java Platform plugin and improved C++ plugins
The Gradle team is back with a new release that brings some very interesting new features. From a new Java Platform plugin to annotation processor improvements, Gradle 5.2 is stuffed with useful changes.
New month, new Gradle release!
The team announced the release of Gradle 5.2 that’s stuffed with new features and improvements.
Let’s have a closer look at all the updates.
All the updates
The Java Platform plugin – 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.
Building native software with Gradle – There are a couple of new features coming online with this release including new C++ plugins, build Init can now generate C++ sample projects, support for additional Windows native toolchains, and support for testing applications on Windows.
Improvements for custom task authors – There are several new services that Gradle makes available for task and plugin implementations to use. Services can be injected into an instance either as constructor parameters or using a property getter method. Both options become available with this release. for all types for which service injection is available. Support for setting environment variables when using Gradle TestKit is also brought by this release.
Maven publication can expose resolved versions – When using the
maven-publish plugin, you can now opt-in to publish the resolved dependency versions instead of the declared ones.
Annotation processor improvements – 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.
JavaExec tasks track the version of Java used – 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.
Head over to the official release notes to have a look at the detailed information on the new features as well as the extensive list of bug fixes.
You should also keep in mind that there is a single deprecation taking place with the new release. The default constructor of
ProjectBuilder is now deprecated and you should always use
ProjectBuilder#builder() to create instances.
If you are looking on how to get started with Grable 5.2, switch your build to use the latest release by updating your wrapper properties:
./gradlew wrapper --gradle-version=5.2
You can also find the standalone downloads are available here.