Installing newer versions of Gradle

I have downloaded V2.2.1 and installed it. There are a lot of errors now. Is there a “best practices” approach to installing newer versions and updating existing projects? Perhaps a step-by-step list of the things that have to be correctly set?

Generally it’s a good practice to use the Gradle Wrapper for a project instead of installing a specific Gradle version on your machine. The reason is that the project can decide which version of Gradle it is compatible with. In practice that means that you can upgrade a single project a newer version of Gradle instead of doing it “globally” by installing a newer Gradle version.

There’s not a specific list for upgrading to a newer version of Gradle. As a general rule of thumb do the following:

  • Before upgrading fix all deprecating warnings. - Read the release notes of the upgraded Gradle version. It should give you an idea of breaking changes.

If you are running on Linux or Mac or some other Unix, my approach has always been to expand a release to it’s own directory and link to whichever one I need. For example, if you look at my /opt directory, I have gradle-2.0/, gradle-2.1/, gradle-2.2/, and gradle-2.2.1/. I create a softlink to whichever one I’m using:

ln -s /opt/gradle-2.2.1 /opt/gradle

and set

GRADLE_HOME=/opt/gradle

I’ve found this approach especially useful for Apache, Tomcat, and toolkits that upgrade frequently. (But if you’re using Windows, best of luck.)