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

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?


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:

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).

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.

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

I believe this has been fixed in the latest nightly build: 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.

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.

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.

Hi Daz,

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

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.

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)
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(
 at org.gradle.tooling.internal.consumer.async.DefaultAsyncConnection$
 at org.gradle.internal.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$
 at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
 at java.util.concurrent.ThreadPoolExecutor$ Source)
 at 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(
 at org.gradle.tooling.internal.consumer.loader.CachingToolingImplementationLoader.create(
 at org.gradle.tooling.internal.consumer.loader.SynchronizedToolingImplementationLoader.create(
 at org.gradle.tooling.internal.consumer.connection.LazyConnection.onStartAction(
 at org.gradle.tooling.internal.consumer.connection.LazyConnection.withConnection(
 at org.gradle.tooling.internal.consumer.connection.ProgressLoggingConnection$
 at org.gradle.tooling.internal.consumer.async.DefaultAsyncConnection$
 at org.gradle.tooling.internal.consumer.async.DefaultAsyncConnection$
 ... 4 more
Caused by: C:\gradle-1.1 (The system cannot find the file specified)
 at Method)
 at<init>(Unknown Source)
 at<init>(Unknown Source)
 at Source)
 at Source)
 at org.gradle.wrapper.Download.downloadInternal(
 at org.gradle.tooling.internal.consumer.DistributionFactory$
 at org.gradle.wrapper.Install.createDist(
 at org.gradle.tooling.internal.consumer.DistributionFactory$ZippedDistribution.getToolingImplementationClasspath(
 ... 15 more

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

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.

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.

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