Could not fetch model of type 'IdeaProject' - Strange configuration problem

The only difference I can think of between importing the project into Idea or NB is the version of Gradle and the JDK you are using. Can you check what version is used to import the project into Idea?

As I understand it, it uses the local install (radio button “Use local gradle distribution” is selected on the import dialog and the “Gradle home:” path is correct), which is Gradle 1.7

I’m running JDK 7u40 for NetBeans, and “gradle -version” reports the same "JVM:

1.7.0_40 (Oracle Corporation 24.0-b56)"

However, IDEA reports JDK 7u10 in the about dialog.

I have just noticed ‘JavadocAndSourcesDownloader’ on the stack trace. Can you try adding to all your build.gradle files except the one in the root project? It will have some obvious downsides but at least we can rule out that the problem is with downloading the sources (or javadoc).

apply plugin: ‘idea’

idea {

module {

downloadJavadoc = false

downloadSources = false

}

}

I noticed something new. My NetBeans install at home seems to be working, while at work it fails. At home I am running NetBeans on JDK 7u40 64-bit, at work I am using 7u40 32-bit.

Home (no error): Java: 1.7.0_40; Java HotSpot™ 64-Bit Server VM 24.0-b56 Runtime: Java™ SE Runtime Environment 1.7.0_40-b43

Work (has problem): Java: 1.7.0_40; Java HotSpot™ Client VM 24.0-b56 Runtime: Java™ SE Runtime Environment 1.7.0_40-b43 Note that on the command line the 64-bit Java is used.

Both use Gradle 1.7.

Note also that when I run gradle from the command line my JAVA_HOME is configured the opposite way to how I have NB configured and it works. I.e. at home, where NB works with 64-bit java, I run 32-bit java on the command line and it also works.

So it doesn’t seem to be as simple as 64 vs 32 bit JVM.

gradle -version output (both cases work from the command line): ------------------------------------------------------------ Gradle 1.7 ------------------------------------------------------------

Build time:

2013-08-06 11:19:56 UTC Build number: none Revision:

9a7199efaf72c620b33f9767874f0ebced135d83

Groovy:

1.8.6 Ant:

Apache Ant™ version 1.8.4 compiled on May 22 2012 Ivy:

2.2.0 JVM:

1.7.0_40 (Oracle Corporation 24.0-b56) OS:

Windows 7 6.1 x86

and

------------------------------------------------------------ Gradle 1.7 ------------------------------------------------------------

Build time:

2013-08-06 11:19:56 UTC Build number: none Revision:

9a7199efaf72c620b33f9767874f0ebced135d83

Groovy:

1.8.6 Ant:

Apache Ant™ version 1.8.4 compiled on May 22 2012 Ivy:

2.2.0 JVM:

1.7.0_40 (Oracle Corporation 24.0-b56) OS:

Windows 7 6.1 amd64

Well the 64/32 isn’t it because I switch my work NB to use 64 bit and it had no effect.

However at least I know that it is something specific to that computer… I just don’t know what the difference is. Gradle, Java, and NetBeans versions are all the same. I could try deleting ~/.gradle from my home computer to see if that makes it fail. (I did that several times while trying to fix things at work.)

Could be something with the cache in “.gradle” or perhaps there is something in “JRE_HOME/bin/ext”. But it could even be some concurrency issue which is triggered by unfortunate timing.

Yes, there is something… but I haven’t been able to figure it out yet…

I’ve deleted ~/.gradle as well as any local .gradle folders in the project directory and the problem remained. All the JDK installs are just standard installs with nothing extra in ‘ext’ folder.

The error is very consistent in terms of which projects report the error, even when I have many other projects loaded or do a re-load on just one of them, so I don’t suspect a timing issue. I didn’t think to check the NB log files for anything not reported directly by the gradle plugin. Will do that next.

I noticed I had different GRADLE_OPTS environment variable settings, but I changed them to be the same and it had no effect. It was just JVM memory settings and that sort of thing, so it wasn’t likely to be the problem.

I found this issue too.

It was coming from one of my tasks:

task thrift {

if (!thriftDir.isDirectory()) {

println(“making dirs”)

thriftDir.mkdirs()

}

if (!thriftJavaDir.isDirectory()) {

thriftJavaDir.mkdirs()

}

thriftFiles.each { file ->

println file

exec {

executable = ‘thrift’

args = [’–gen’, ‘java:hashcode’, ‘-out’, thriftJavaDirName, file ]

}

/* (This was causing in IDE error - Removing it fixed the issue.)

exec {

executable = ‘thrift’

args = [’–gen’, ‘py’, ‘-o’, thriftDirName, file ]

}

*/

} }

The problem is that your task “thrift” is a no-op. You are doing everything in script evaluation time. That is, you are missing a “doLast” or “doFirst”.