I have a problem with gradle wrapper version in intellij idea. When I import a project it starts to download the old version of gradle and gradle wrapper
In my system variables I have gradle home which looks like this:
And in Path of system variables:
My gradle build file looks like this:
plugins {
id 'java'
id 'org.jetbrains.kotlin.jvm' version '1.3.41'
}
group 'com.epam.trykotlin'
version '1.0-SNAPSHOT'
sourceCompatibility = 1.8
repositories {
mavenCentral()
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
testCompile group: 'junit', name: 'junit', version: '4.12'
}
compileKotlin {
kotlinOptions.jvmTarget = "1.8"
}
compileTestKotlin {
kotlinOptions.jvmTarget = "1.8"
}
task wrapper(type: Wrapper) {
gradleVersion = '5.6.4'
}
My gradle.xml in .idea folder looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleHome" value="C:/Gradle/gradle-5.6.4" />
<option name="gradleJvm" value="11" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
</set>
</option>
<option name="useQualifiedModuleNames" value="true" />
</GradleProjectSettings>
</option>
</component>
</project>
I've already tried to remove .gradle folder and .IdeaIC2019.2 folder but I've got the same problem. Why is it happened? How it can be fixed? I've also tried to reinstall IDE and it installs gradle plugin with 5.2.1 version. Why?
In your particular use-case, you could probably first - outside of IntelliJ - run gradle wrapper
in a terminal window in order for Gradle to setup the wrapper for the project using the version specified in your build file.
However, it seems like IntelliJ is hardcoded to download a Gradle wrapper 5.2.1
for all new projects and for all opened projects that haven't previously been configured any differently.
There doesn't seem to be any way of disabling this very odd behavior. This is sad, and almost beyond belief. Not only will this steal the user's Internet bandwidth and disk space, but it also causes major confusion and time-waste when the developer proceeds to debug his project setup and scratch his head why on earth this is happening.
I didn't stick around long enough to figure out if IntelliJ goes so far as to use an old version of Gradle that he downloaded instead of using the latest Gradle version I already have installed. Of course, it really wouldn't surprise me.
So the answer to your question why must be "a poorly designed Gradle plugin by self-proclaimed developers who long since forgot who they are working for".
The first thing we need to do though is to stop the extremely annoying download.
But, - and I kid you not - aborting the download I could only successfully do if I completed every single step in the following very onerous process. Cheating out on anyone of these steps didn't stop the download. Even though many of these steps don't seem to have an effect on the surface, every step did have an undisclosed side-effect that eventually contributed to the successful death of the download.
Then, we need to remove crap IntelliJ put on our disk. On my machine:
rm -r ~/.gradle/wrapper/dists/gradle-5.2.1-bin/
Now, we can open IntelliJ and go directly to our project without starting any Gradle downloads.
However, I want IntelliJ to use the Gradle I have installed. So I open the project and use the menu to open "File -> Settings -> Build, Execution, Deployment -> Build Tools -> Gradle". In there I do the following:
Gradle
Gradle
Specified location
/usr/lib/gradle/default
Of course all of the above must be repeated for every new project we wish to create and/or open.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With