Project SDK Version is ignored for Gradle
I have a simple Gradle project with a configured Project SDK Java 1.8.
Running the project as a Java application inside IntelliJ works fine and Java 1.8 is used.
But if I use a Gradle task like "run" inside the IntelliJ the SDK-Version is ignored.
It takes always Java 1.7 which is the default on my operation system.
Is there a way to force the Gradle process to use the configured Project SDK?
Bonus question:
Intellij comes with a Gradle wrapper to Version 2.0. Is there a way to update
the wrapper to use Gradle 2.3?
Thanks!
Please sign in to leave a comment.
Anyone? Thanks....
Can somebody from JetBrains help and answer the questions?
Thanks!
yes, if you use IDEA 14.1 you can set JDK for Gradle in settings, see details at https://youtrack.jetbrains.com/issue/IDEA-134428
For earlier IDEA versions you could use 'gradle.java.home' property, just add the following line to your '$IDEA_HOME/bin/idea.properties' file:
yes, open Gradle Settings
if the following option is available "Use default gradle wrapper (recommended)", turn it on and open <your_project_path>\gradle\wrapper\gradle-wrapper.properties file and edit distributionUrl as follows:
if you use "Use customisable gradle wrapper" option, you can set the version you want in the build.gradle script of you root project:
see details about wrapper task at https://gradle.org/docs/current/userguide/gradle_wrapper.html
or you can install gradle locally and select "Use local gradle distribution" option.
Thanks Vladislav! Great information!
When will the IDEA Version 14.1 be released?
it's expected roughly at the end of March
Unfortunately, https://youtrack.jetbrains.com/issue/IDEA-134428 does not seem to fix similar problem for me. In fact, I have JDK 1.8 set as JAVA_HOME, and also as Project SDK and as Gradle JVM as per setting above.
It still launches Gradle from JDK 1.7 JVM.
When I run gradlew.bat from the command line, it uses right JVM