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


Open Source On Mars Acknowledged With A Badge
20/04/2021

Ingenuity has made its maiden flight on Mars. It may only have lasted a few seconds, but signals an incredible achievement. It was done thanks to open source software and the nearly 12,000 developers  [ ... ]



Visual Studio 2022 Will Be 64-bit
20/04/2021

Microsoft has released details of Visual Studio 2022, a preview of which will be released this summer. The headline change is that the new version will be 64-bit.


More News

square

 



 

Comments




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

Last Updated ( Thursday, 15 April 2021 )