Love It or Hate It, Gradle Reaches Version 7.0
Written by Nikos Vaggalis   
Thursday, 15 April 2021

Gradle is a tool that always stirs arguments among developers. Let's see what version 7 brings and breaks.

gradlebanner

I first encountered Gradle when developing on Android and my first impression was that it wasn't the most friendly of tools; cryptic syntax, contradictory terms (see compile versus implementation) and peculiar blocks of elements.

The Groovy to Kotlin DSL jump is another testament to the tool's Android roots and as the platform evolved so has Gradle. After Android I've used Gradle in the all-Maven world of Spring Boot world and it really felt at odds, making my life miserable at times as I juggled the syntax, the plugins and the dependencies.

After everything finally clicked together, I got into "if it works,do not fiddle with it" mentality, fearing that the slightest change might break my build. In contrast, for those kind of Java projects, I've found Maven easier to use and comprehend due to its concrete structure and more obvious ways of doing things.

I think that my case resonates in general and it really all comes down to Bruce Eckel's saying:

"To do anything [in Gradle] you have to know everything".

And, of course, the fact is that almost every version upgrade breaks ties with the past. I cannot use an older version of Gradle to compile a project built with a newer one. I guess you could say that this is solved with the wrappers, but still..

In any case, a new version 7.0 has just been released, so let's take a look at what it brings and what it breaks.

First of all it brings support for Java 16. Then there's: 

  • File system watching changes for quicker incremental builds
  • Native support for Apple silicon
  • Groovy 3 in Groovy DSL build scripts
  • Performance improvements for incremental changes in Android projects 

Also. it sponsors a new feature called "version catalogs" which simplifies version management in that it shares dependency versions between projects.

The version catalogs are shared by and are accessible by all projects of a build, therefore their main advantage is that when you introduce a dependency version it gets replicated for each project.

Version catalogs is experimental and can be enabled by editing the settings.gradle and enabling:

enableFeaturePreview("VERSION_CATALOGS")

Of course, as always, there are breaking changes as well: 

  • Due to the update to the next major version of Groovy, you may experience minor issues when upgrading to Gradle 7.0.
  • In Gradle 7, both the compile and runtime configurations are removed. Therefore, you have to migrate to the implementation and api configurations above. If you are still using the java plugin for a Java library, you will need to apply the java-library plugin instead. 

There's a whole guide on upgrading from version 6x to 7.0, and of course 160 bug fixes.

These are the most important changes but there's a whole lot more which can be found in 7.0's release notes.

So in the end is Gradle's version 7 a necessity in order to catch up with the developments of the Android platform, as such it is still mostly Android oriented.

Are pro or anti using Gradle, and are you using it in non-Android projects too? Leave a comment below to let us know.

 Gradle7sq

More Information

Gradle 7.0 Release notes

Related Articles

Introducing The Android Kotlin Developer Nanodegree

Insider's Guide To Udacity Android Developer Nanodegree - 1

Android Jetpack Compose Is Welcome, But What About The Churn?

 

To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.

Banner


PHP 8.4 Adds Property Hooks
26/11/2024

PHP 8.4 is available with improvements including property hooks, asymmetric visibility, and an updated DOM API.



Advent Of Code 2024 Now Underway
01/12/2024

December 1st is much anticipated among those who like programming puzzles. It is time to start solving small but tricky puzzles on the Advent of Code website with the goal of amassing 50 stars by Chri [ ... ]


More News

espbook

 

Comments




or email your comment to: comments@i-programmer.info

Last Updated ( Thursday, 15 April 2021 )