What's new and noteworthy?

Gradle 4.8: Dependency locking and performance improvements

Jane Elizabeth
© Shutterstock / Villiers Steyn

The latest update from Gradle is sure to keep everyone smiling. The new Gradle 4.8 boasts a number of improvements that are sure to delight Gradle users, including dependency locking, plugin upgrades for Maven and Ivy, and improvements to incremental annotation processing.

It’s only been six weeks since Gradle 4.7 brought JDK 10 support to the popular build automation system, making Java developers’ lives easier. But in that time, the Gradle team has developed a host of improvements for Gradle 4.8 including dependency locking, an awful lot of improvements to publishing plugins, and more incremental annotation processing improvements.

In addition, Gradle 4.8 includes the latest Kotlin upgrade to ensure that Kotlin 1.2.41 can take of the latest improvements for user experience and performance.

Let’s take a look at what’s new and noteworthy in Gradle 4.8.

Dependency locking

Gradle now supports dependency locking. If you haven’t had dependency locking before, it’s a mechanism for locking dynamic versions in place. Changing dependencies often results in a series of cascading failures if a new dependency doesn’t play nicely with the existing structure.

With dependency locking, dependencies can be declared against major or minor version range. In essence, this lets developers test the build with the latest dependency versions on CI, while still using the locked version for a stable developer build.

Dynamic dependencies are still useful, so teams that want to take advantage of them can still do so. The dependencies can be locked for releases only, making it so that build is fully reproducible if and when making bug fixes.

Changes to published dependencies don’t impact your build if they are locked, keeping things from accidentally causing any errors. However, they will need to be re-generated or updated before they are considered as dependencies again. The dependencies don’t change without a matching update in the lock file.

SEE ALSO: Build Gradle projects with Eclipse Buildship

Publishing plugins

Gradle 4.8 boasts a number of improvements to the publishing plugins to make things easier for developers. This includes:

Additionally, the maven-publish and ivy-publish plugins are now stable for use. Developers should transition away from using the maven plugin, as it is slated for depreciation.

Incremental annotation processing

Another upgrade for Gradle 4.8 is the improvement for incremental annotation processing APIs. Previously, the compilation would fail if the processor tried to do something wouldn’t work incrementally. Now, Gradle just does a full recompile and informs the user about the problem without causing an error.

Additionally, incremental compilation is now possible even if there are unused non-incremental processors. In Gradle 4.8, developers finally can package both incremental and non-incremental processors together safely. However, unless actively specified, everything will remain incremental.

Finally, processors gain a certain self-awareness and can determine if they are incremental or non-incremental. That said, before some annotation processors with extension mechanisms can opt-in, they will need to first check to see if everything is incremental or not.

For more information on annotation processes, check the full documentation for more support.

SEE ALSO: Java enthusiasts rejoice! Gradle 4.7 adds JDK 10 support

Getting Gradle 4.8

For more information about Gradle 4.8, see the release notes for the complete list of changes, depreciations, and more.

To use Gradle 4.8, you’ll have to update your wrapper properties:

gradle wrapper --gradle-version=4.8

The standalone download is available here. Feedback is always welcome via GitHub or Twitter.

Jane Elizabeth
Jane Elizabeth is an assistant editor for

Leave a Reply

Be the First to Comment!

Notify of