PLEASE NOTE: THIS IS NOT A DUPLICATE. I want Gradle's IDEA plugin to correctly configure my IntelliJ IDEA CE project for me. I am not interested in any solution that involves manually tuning IntelliJ to find my JDK. This is a Gradle IDEA plugin feature that can and should work.
If you can find another question that involves correctly getting the Gradle IDEA plugin to configure IntelliJ (running on a Mac) so that it can find JDK 8+, then please by all means, mark this as a dupe and provide a link to that question. Otherwise, do not vote this as a dupe (it's not!).
Mac 10.9.5 here. Java 8 is my default JRE/JDK, and I just installed Groovy 2.4.6 and Gradle 2.13 via sdkman
. I then installed IntelliJ IDEA CE.
On my terminal, I created a test-proj
directory, and then inside that directory I issued the following Gradle command:
gradle init --type groovy-library
Gradle executed successfully, giving me a Groovy project skeleton. I then edited the generated build.gradle
to contain the IDEA plugin:
apply plugin: 'idea'
And then I ran:
gradle wrapper
./gradlew clean idea
This generated the Gradle Wrapper for me, and I then used the IDEA plugin to generate IntelliJ project files for me. I then opened my brand-spanking-new IntelliJ IDE and went to Open
my test-proj
.
The project opened and everything appeared to be OK. But then I started coding and noticed that JRE classes such as String
were not showing up as resolvable. So I went to File >> Project Structure
and see this:
So it appears that IntelliJ can't find my default Java 8 JDK. I know the OS can find both the JRE and the JDK, based on the console ouput of java -version
and javac -version
. But something, between sdkman
, Gradle or IntelliJ is preventing the IDE from finding Java. Any ideas?