Could not fetch model of type 'EclipseProject' using Gradle distribution


(sirinath1978m) #1

I am getting the following error:

Could not fetch model of type ‘EclipseProject’ using Gradle distribution

This happens in project which refer subspojects which have dependencies and also uses the eclipse plugin. What is happening?


(Szczepan Faber) #2

Hello!

I need more information to answer your question :slight_smile:

  1. The full stack trace 2. Steps to reproduce 3. Gradle version you use

The stack trace at minimum. Without that I cannot really help :confused:


(Carlo Luib-Finetti) #3

I met this error message again today, and I had the days before. The real reason is: the STS Eclipse plugin that brings Gradle integration to Eclipse is based on an older version of Gradle. I’m using Gradle 0.9 RC. So my project scripts are using the new dynamic properties mechanism. STS Gradle plugin complains on “ext”. So I tried to make STS know my local Gradle installation (Preferences/Gradle/Folder). And then the above error message appears.

I think the real problem lies here: STS based Gradle Eclipse plugin cannot really use an external Gradle installation. Further, the STS folks should release updates parallel with Gradle (if that would be possible).


#4

Actually, the Gradle Tooling API, which STS uses, does a pretty good job of providing forward and backward compatibility. If you use the Gradle wrapper (which we highly recommend), then STS will use the version of Gradle declared in your build script. It is possible to override this within STS, but a version of STS built against Gradle N should be able to run a build using Gradle N+1.

I think the issue you’re seeing is probably GRADLE-2185. This is a regression introduced in M9, but does not imply that a new version of STS is required, just a fix to Gradle.


(Carlo Luib-Finetti) #5

thanx Daz, I will try monday (now it’s Friday On My Mind, if you know what I mean)


#6

I believe this has been fixed in the latest nightly build: http://gradle.org/nightly. Please try it out and see if it works for you with Eclipse + Gradle Plugin. You can either update your project’s Gradle wrapper to point at the nightly, or tell Eclipse to always use the nightly version.


(Carlo Luib-Finetti) #7

I think the problem lies in the special way of glueing things together that Eclipse plugins require.

What I tried today is to hack the STS/Gradle integration within my Eclipse 3.7. I found the plugin directory “com.springsource.sts.ide.ui_2.9.0.201203011000-RELEASE”, where I exchanged the milestone 0-7 jars in lib with the “1.0-milestone-9”-jars. And then I editet the MANIFEST.MF-file, where the versioned jars are definied within the “Bundle-ClassPath”.

Well, I thougth I’d be clever (also dirty) and could manage the things. But now I get another errror “java.lang.NoClassDefFoundError: org/gradle/tooling/model/DomainObjectSet” - an error which I do not understand, because the class exists in one of the gradle jars. I do not know where else things are glued together, so I give up here.


#8

As I mentioned, there is a bug in Gradle 1.0-milestone-9 that means it won’t work with STS on Windows. You probably want to download the latest nightly build and try that, since we think the bug has been fixed.


(Carlo Luib-Finetti) #9

Hi Daz,

I cannot see how your builds can override the Eclipse plugin definitions which reside in MANIFEST.MF of the STS-Gradle plugin.


#10

The Eclipse plugin has a hard-wired version of the Gradle Tooling API: read about it here. The Tooling API generally does a good job of running a build with any Gradle version.

We spent a lot of time making this work. You should try it out.


#11

I realize it is an old thread, but I am getting the same error now with STS 3.1. It happens when I try to run Gradle using STS (Right click on build.gradle -> run as -> Gradle build). I tried to point it to my Gradle directory or Gradle distribution file, but it had no effect. I have Gradle 1.2.

Here is the stack trace:

!ENTRY org.springsource.ide.eclipse.gradle.core 4 0 2012-11-15 23:13:12.851
!MESSAGE C:\gradle-1.1 (The system cannot find the file specified)
!STACK 0
org.gradle.tooling.GradleConnectionException: Could not fetch model of type 'EclipseProject' using Gradle distribution 'file:/C:/gradle-1.1/'.
 at org.gradle.tooling.internal.consumer.ResultHandlerAdapter.onFailure(ResultHandlerAdapter.java:55)
 at org.gradle.tooling.internal.consumer.async.DefaultAsyncConnection$2.run(DefaultAsyncConnection.java:71)
 at org.gradle.internal.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:66)
 at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
 at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.IllegalArgumentException: The specified Gradle distribution 'file:/C:/gradle-1.1/' does not exist.
 at org.gradle.tooling.internal.consumer.DistributionFactory$ZippedDistribution.getToolingImplementationClasspath(DistributionFactory.java:110)
 at org.gradle.tooling.internal.consumer.loader.CachingToolingImplementationLoader.create(CachingToolingImplementationLoader.java:36)
 at org.gradle.tooling.internal.consumer.loader.SynchronizedToolingImplementationLoader.create(SynchronizedToolingImplementationLoader.java:43)
 at org.gradle.tooling.internal.consumer.connection.LazyConnection.onStartAction(LazyConnection.java:122)
 at org.gradle.tooling.internal.consumer.connection.LazyConnection.withConnection(LazyConnection.java:105)
 at org.gradle.tooling.internal.consumer.connection.LazyConnection.run(LazyConnection.java:96)
 at org.gradle.tooling.internal.consumer.connection.ProgressLoggingConnection$1.run(ProgressLoggingConnection.java:57)
 at org.gradle.tooling.internal.consumer.connection.ProgressLoggingConnection.run(ProgressLoggingConnection.java:71)
 at org.gradle.tooling.internal.consumer.connection.ProgressLoggingConnection.run(ProgressLoggingConnection.java:55)
 at org.gradle.tooling.internal.consumer.connection.LoggingInitializerConnection.run(LoggingInitializerConnection.java:52)
 at org.gradle.tooling.internal.consumer.async.DefaultAsyncConnection$1.run(DefaultAsyncConnection.java:51)
 at org.gradle.tooling.internal.consumer.async.DefaultAsyncConnection$2.run(DefaultAsyncConnection.java:69)
 ... 4 more
Caused by: java.io.FileNotFoundException: C:\gradle-1.1 (The system cannot find the file specified)
 at java.io.FileInputStream.open(Native Method)
 at java.io.FileInputStream.<init>(Unknown Source)
 at java.io.FileInputStream.<init>(Unknown Source)
 at sun.net.www.protocol.file.FileURLConnection.connect(Unknown Source)
 at sun.net.www.protocol.file.FileURLConnection.getInputStream(Unknown Source)
 at org.gradle.wrapper.Download.downloadInternal(Download.java:63)
 at org.gradle.wrapper.Download.download(Download.java:49)
 at org.gradle.tooling.internal.consumer.DistributionFactory$ProgressReportingDownload.download(DistributionFactory.java:132)
 at org.gradle.wrapper.Install.createDist(Install.java:51)
 at org.gradle.tooling.internal.consumer.DistributionFactory$ZippedDistribution.getToolingImplementationClasspath(DistributionFactory.java:108)
 ... 15 more

(Peter Niederwieser) #12

Looks like you’ve still configured STS to use Gradle 1.1.


#13

Hi Peter, Gradle 1.1 is not configured in Gradle preferences of the STS. Moreover I renamed my Gradle 1.2 directory to C:\gradle-1.1 as it says in the error, but got the same results.


(Peter Niederwieser) #14

Hard to say what the problem is. A few things you can try: Delete the directory, try the different options to provide a Gradle version (file/URI/wrapper), reinstall the plugin, investigate the Eclipse error log. You can also ask in the STS forum or file an issue in the eclipse-integration-gradle GitHub project.


(Szczepan Faber) #15

It might be best if you ask about this problem in the STS forum. Cheers!