Upgrading to the latest verison of Gradle (or “Upgradling” as my colleague just called it) is fairly easy. But if you think there’s some simple gradle command to do it, then you’d be wrong. It’s basically the same as upgrading ant.
If you’re using Gradle wrapper, then it’s a doddle. Sort of.
So, if you’re NOT using Gradle Wrapper, do this:
- Download the new version of gradle and unzip it somewhere.
- Change your GRADLE_HOME variable to point to the new path and marvel at your achievement
(I’m assuming you already have GRADLE_HOME/bin on your path). Of course, if you’re using Linux, you have to make sure you unzip the Gradle zip on your Linux distro otherwise the file permissions go all screwy.
If you ARE using Gradle Wrapper:
…you’ll have a whole bunch of gradle wrapper files and directories. You just need to update an entry inside one of these files. The file you’re looking for is gradle-wrapper.properties, and it usually lives under the gradle/wrapper dir.
Here’s an example of a gradle-wrapper.properties:
As you can see, you just need to update the last line with the new version of gradle you want to use. One drawback with using gradle wrapper is that you have a bunch of gralde build files and directories cluttered all over the place.