Gradle multiple versions of GRADLE

For clarity: this is NOT about several versions of dependencies, about several versions of Gradle's own banks.

I thought this one might have an answer ... but it is not!

This is Gradle 2.14 with Windows 10.

I found that Gradle was constantly creating a new directory in the ".gradle" directory for this project: next to the legal directory "2.14", he continued to create the directory "2.2.1".

I looked under my directory where Gradle was installed: and I was perplexed to find several versions of the Gradle jar files: not only 2.14, but also 2.13, 1.7 and yes, 2.2.1 ..

So, I decided to manually remove 2.2.1. cans. He stopped creating the "false" directory 2.2.1.

Can someone tell me how Gradle decides which version it uses? I would really like to get rid of these non-2.14 cans and find a way to prevent other versions crawling in some way!

+5
source share
1 answer

Can someone tell me how Gradle decides which version it uses?

It depends on how you call gradle.

Method 1 .. The gradle command will display the version of Gradle that is in the GRADLE_HOME path.

Method 2. Using gradle wrapper

Command

A gradlew will invoke the version of Gradle that is configured in the gradle\wrapper\gradle-wrapper.properties project file if it already exists. If not, you can create it on gradle wrapper --gradle-version 3.3 . Now when you use gradlew , it will always use Gradle version 3.3.

It is recommended that you use the Gradle shell so that you can play the same assembly sequentially on different machines where the installed versions of Gradle may differ, or even on machines where Gradle is not installed, because gradlew.bat and gradlew will be used for windows and linux respectively for bootstrap assembly.

The reason you found several versions of Gradle in your .gradle directory might be because you might have previously tried to build gradle with these versions.

+4
source

Source: https://habr.com/ru/post/1264124/


All Articles