3 min read

Team Gradle has released a new version of their tool and that’s Gradle 4.9. Gradle is a build tool for build automation with multi-language development. It offers excellent flexibility to the complete development lifecycle.

As per the team, one of the quickest ways to update one’s build to use the new version is by updating the build wrapper properties as follows:

./gradlew wrapper --gradle-version=4.9

However, the standalone downloads are available at gradle.org/install

What’s new in the Gradle 4.9

Command line arguments are now supported by JavaExec

One can now pass command line arguments to JavaExec using –args. This means if one wants to launch their application using the command line arguments foo –bar, hardcoding it into the build script is not required. One just has to simply run gradle run –args ‘foo –bar.


An improved dependency insight report

This version features an improved dependency insight report including build scans.  The report helps in easy diagnosis of dependency management problems, locally. Some improvements in this report include:

  • All participants of conflict resolution are shown
  • All custom reasons for a component selection are shown
  • Modules rejected by a rule are displayed
  • Modules which didn’t match the version selector but were considered in the selection are shown
  • This report also solves the readability resolution failures by restricting the report to one path with each dependency.

Native ecosystem continues

The Gradle Native project stays steady in order to improve and evolve the native ecosystem support for Gradle.

Checkout builds are now fast and clean

This version now stores more states in the Gradle user home instead of the project directory. This results in clean and faster checkout builds on CI as long as the user home is preserved.

Java and Groovy compilers are now leak-proof file descriptors

By default, the Java and Groovy compilers both leak file descriptors during the run in-process. This, in turn, can lead to “cannot delete file” exceptions on Windows and “too many open file descriptors” on Unix.

In the Gradle 4.9, these leaks have been fixed. Users who had switched to forking mode because of this problem, can now safely switch back to in-process compilation.

Experimental new task API

Gradle 4.9 includes a new task API which allows builds to avoid the cost of creating and configuring tasks for the ones that will never be executed.

By upgrading to this new API, one can experience slightly faster configuration times. The benefits will keep improving as more plugins adopt this API.

Note that this API is in incubation and may change before Gradle 5.0.

The promoted features are now stable

This version includes some promoted features which were in incubation during the previous release. The promoted features which include a stable dependency insight report and the tooling API types and methods are now supported and stable. These two features are also subject to backward compatibility.

Potential breaking changes in Gradle 4.9

  • EclipseProject tasks defined for gradle eclipse are allowed to run in Buildship. Two tasks from the EclipseProject, namely the EclipseClasspath and EclipseProject are now executed by the gradle.
  • Use of Groovy GPath expression with the method, tasks.withType() would get a runtime exception. The easiest fix is to explicitly use the spread operator.

As per my past research on Gradle and observing its past release trends, it looks like we can expect Gradle 5.0 in August or September.

Read more about the other fixed issues and deprecations in the Gradle 4.9 release notes.

Read Next

 


Subscribe to the weekly Packt Hub newsletter. We'll send you the results of our AI Now Survey, featuring data and insights from across the tech landscape.

LEAVE A REPLY

Please enter your comment!
Please enter your name here