Gradle version outdated when creating a new Project

已回答

Hello,

unfortunately i havent found anything regarding this issue in the forums or on the internet in general.

When you create a new gradle Project in IntelliJ, it automatically downloads a gradle version 5.2.1 it seems. This is an outdated vcersion and i want IntelliJ to create the project with a specific gradle version OR the newest one ( if it is downloaded from a remote repository )

Project after creation:

 

The only solutions i could find are only applyable AFTER the project is already setup with the outdated gradle init.

Amongst the solutions are:

Setting a specific folder location of the gradle version i want IntelliJ to use:

which ( only AFTER restarting IntelliJ) seem to result in a new folder being created and now creating something what seems to be a " 2 gradle version" project.

but still using some configuration of the old one with a new wrapper ( i guess the gradlw.bat is being updated ? ) since it is unable to compile anymore once i do this:

Basicly applying a gradle settings change in intellij only applies to the CURRENT project.

-> But therefore it is mandatory that a project has actually been created thus being created with the outdated Gradle version.

(from JetBrains  https://www.jetbrains.com/help/idea/gradle.html#gradle_version_install )

Is there a way to generally let IntelliJ use a specific Gradle version the moment it sets up the project?

 

Is there i file somewhere that points IntellJ to the repository that is being used when downloading a Gradle version or a local version ?

 

Regards from vienna

 

 

 

评论操作 固定链接

My specs

IntelliJ IDEA 2019.2.4 (Ultimate Edition)
Build #IU-192.7142.36, built on October 29, 2019
Runtime version: 11.0.4+10-b304.77 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0
GC: ParNew, ConcurrentMarkSweep
Memory: 1974M
Cores: 12
Registry:
Non-Bundled Plugins: org.jetbrains.kotlin, org.sonarlint.idea

0
评论操作 固定链接

Can you please check the gradle/wrapper/gradle-wrapper.properties file? What's its content?

0
评论操作 固定链接

This is the content of the <Project>/gradle/wrapper/graddle-wrapper.properties

 

I noticed another thing. It seems that the settings i have changed in IntelliJ have actually affected the Gradle Installation since inside the

Gradle\gradle-6.5\wrapper\dists  (Which in this case is the Gradle version i want IntelliJ to use instead of the 5.2.1)

there is a folder now with the Gradle version 5.2.1 downloaded by IntelliJ

0
评论操作 固定链接

I considered that IntelliJ might use the system variable set in GRADLE_HOME as default and when there isnt one explicitely set, i uses some (old) repository.

But my GRADLE_HOME variable is set to the right path und still it doesnt exectute the newer gradle version 6.5.

and Path:

 

But it doesnt seem to be the case...

0
评论操作 固定链接

Gradle Wrapper in version v5.2.1 is downloaded because this is the version specified in the file that I've asked you for.

Please read our docs regarding the Getting Started with Gradle

0
评论操作 固定链接

Well of course it is. Thats kinda the question and problem i am having....

Is there a way that IntelliJ is NOT using a deprecated version of Gradle on creating a project. Where in IntelliJ is defined what version of Gradle it will use when creating the project. Am i stuck with 5.2.1 and then i manually have to upgrade my whole project to the latest version every time i create one ?!

0
评论操作 固定链接

Ok, thanks for the clarification. Let's go with some details - Gradle Wrapper is created automatically by the Gradle plugin when you create an empty project based on it. There is the following template used to provide gradle-wrapper.properties with the specific version. Such template is available here:

https://github.com/JetBrains/intellij-community/blob/master/plugins/gradle/resources/fileTemplates/internal/Gradle%20Kotlin%20DSL%20Build%20Script%20with%20wrapper.gradle.ft

We can see that v5.2.1 is used as a fallback if there is no $GRADLE_VERSION provided. This variable is provided by the plugin for the ft template file - value is resolved using

GradleVersion.current().getVersion()

Gradle library is built-in, so this version is fixed and depends on the IDE version, i.e. IDE 2019.x has 5.2.1; IDE 2020.1 has 6.1.1:

https://github.com/JetBrains/intellij-community/blob/193/.idea/libraries/Gradle.xml

https://github.com/JetBrains/intellij-community/blob/201/.idea/libraries/Gradle.xml

 

0
评论操作 固定链接

Ok,

thanks for your effort to help me.

So if i am undestanding this correctly then only if there is no $GRADLE_VERSION variable set then(!) it falls back to the internal fixed IntelliJ version which is 5.2.1 ( in my case )

Where can i set this variable for the plugin ?

I have looked at the supposed location inside my IntelliJ installation folder, according to the github you have provided me above:

to manually change the fallback number to the newest available version at least (the $GRADLE_VERSION variable itself isnt set in this code either).

Unfortunately there is none such folder inside my IntelliJ.....

 

From where does the code from the github above resolve the $GRADLE_VERSION variable anyway ? From IntelliJ ?

If that is the case and its a fixed version, why write the else statement ( if no variable is set, fallback to 5.2.1 ) in the first place ? Im truly confused by all of this ^^

0
评论操作 固定链接

GRADLE_VERSION is not an environment variable but a variable passed from the Java to the template. Unfortunately, it is not possible to override it.

There are two issues in our YouTrack that you can follow regarding the possibility of manual setting of the Gradle version used for the new projects: IDEA-177325IDEA-215792

0

请先登录再写评论。