Gradle JVM selection
If you created or opened a Gradle project and for some reason the version of Gradle JVM in your project is not what you've expected, you can check the following procedures to see how IntelliJ IDEA chooses the specific Gradle JVM version.
Let's say you are creating a project.
Resolve the Gradle JVM version for a new project
If you use a project SDK which is JDK then Gradle JVM will be equal to your project's SDK. Basically, Gradle JVM equals Project SDK.
If the project's SDK equals JRE then IntelliJ IDEA will use the same steps as in opening an existing Gradle project.
If there is a Gradle wrapper, then IntelliJ IDEA will use the most compatible existing Gradle version on the machine. If you don't use the Gradle wrapper in your project then Tooling API and the Gradle wrapper that Tooling API will generate is used.
When you open a Gradle project for the first time, IntelliJ IDEA checks several places one by one to establish what version of Gradle JVM to use.
Resolve the Gradle JVM version for the existing project
IntelliJ IDEA checks the
gradle.properties
file for the appropriate Gradle JVM specified inorg.gradle.java.home
and uses it for the project.Then it checks the
JAVA_HOME
environment variable.Then it checks the closest appropriate JDK version for the existing Gradle version.
When you add a module to your project, IntelliJ IDEA will do the following:
Resolve the Gradle JVM version for a module
IntelliJ IDEA will use the Gradle JVM version if there is one in other modules.
If there is no Gradle JVM then IntelliJ IDEA will follow the same steps as in Resolve the Gradle JVM version for the existing project.
When you import a module, IntelliJ IDEA uses Gradle defined in the project. If it is not then IntelliJ IDEA executes the same steps as in opening a project.
Access the Gradle JVM settings
In the Settings/Preferences dialog Ctrl+Alt+S, go to .
On the Gradle settings page, under the Gradle section, use the Gradle JVM option to check the Gradle version used for importing a project.