Reputation: 4157
I have IntelliJ 12.0 on and gradle 1.2. on Windows 7. When I try to import a build.gradle file I get the following error message in IntelliJ. I am a bit lost here. Any ideas on how to fix this?
(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
Caused by: org.jetbrains.plugins.gradle.remote.GradleApiException:
Could not fetch model of type 'BasicIdeaProject' using Gradle installation 'C:\Program Files (x86)\gradle-1.2'.
The newly created daemon process has a different context than expected.
It won't be possible to reconnect to this daemon. Context mismatch:
Java home is different.
Wanted: DefaultDaemonContext[uid=null,javaHome=c:\program files (x86)\jetbrains \intellij idea 12.0\jre\jre,daemonRegistryDir=C:\Users\Nilo\.gradle \daemon,pid=5144,idleTimeout=null,daemonOpts=-XX:MaxPermSize=256m,-XX: +HeapDumpOnOutOfMemoryError,-Xmx1024m,-Dfile.encoding=windows-1252]
Actual: DefaultDaemonContext[uid=d8c5c4bc-5488-42c2-b4b3-28c1d53afacf,javaHome=C: \Program Files (x86)\JetBrains\IntelliJ IDEA 12.0\jre,daemonRegistryDir=C:\Users\Nilo \.gradle\daemon,pid=6880,idleTimeout=10800000,daemonOpts=-XX:MaxPermSize=256m,-XX:+HeapDumpOnOutOfMemoryError,-Xmx1024m,-Dfile.encoding=windows-1252]
at org.jetbrains.plugins.gradle.remote.impl.GradleProjectResolverImpl.resolveProjectInfo(GradleProjectResolverImpl.java:61)
... 21 more
Upvotes: 7
Views: 6256
Reputation: 1789
IntelliJ v15.0.6, same problem.
I'm using a JRE that's not the one that is built into IntelliJ.
Now my gradle build scripts work fine from within IntelliJ.
Upvotes: 1
Reputation: 558
Though I did not find the root cause where the different javaHomes have been taken from, at least I found a workaround that worked for me:
Try setting the following in your gradle.properties
(either in %USERPROFILE%\.gradle\
or in your project build dir):
org.gradle.java.home=C:\Program Files (x86)\JetBrains\IntelliJ IDEA 12.0\jre
Upvotes: 2
Reputation: 780
my fix: File -> Project Structure -> change the jdk path to not have jre.
I'm not sure how it got there, but it took me forever to track down. Perhaps because it picked up settings from a previous bad install.
Upvotes: 3
Reputation: 7179
Looks like it might be fixed in 12.1 or 12 EAP: IDEA-102365, IDEA-89697
Upvotes: 3