Skip to content
This repository has been archived by the owner on Jul 9, 2022. It is now read-only.

Error importing projects - Build Model: InconsistenProjectHierarchyException #59

Open
i23098 opened this issue Nov 10, 2014 · 8 comments

Comments

@i23098
Copy link

i23098 commented Nov 10, 2014

I have a project with sub-projects (https://github.com/i23098/Collections) that compiles correctly on the command-line. When I try to import the project in Eclipse I get an error and tells me to check the log... Checking it, it has:

!ENTRY org.springsource.ide.eclipse.gradle.core 4 0 2014-11-09 17:03:13.404
!MESSAGE Gradle project hierarchy is inconsistent for '/home/ralmeida/workspace-collections/Collections'
!STACK 0
java.lang.reflect.InvocationTargetException
at org.springsource.ide.eclipse.gradle.core.util.GradleRunnable.run(GradleRunnable.java:113)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:122)
Caused by: org.springsource.ide.eclipse.gradle.core.InconsistenProjectHierarchyException: Gradle project hierarchy is inconsistent for '/home/ralmeida/workspace-collections/Collections'
at org.springsource.ide.eclipse.gradle.core.util.ExceptionUtil.inconsistentProjectHierachy(ExceptionUtil.java:82)
at org.springsource.ide.eclipse.gradle.core.GradleModelProvider$GroupedModelProvider.getCachedModel(GradleModelProvider.java:339)
at org.springsource.ide.eclipse.gradle.core.GradleProject.getGradleModel(GradleProject.java:634)
at org.springsource.ide.eclipse.gradle.core.GradleProject.getSkeletalGradleModel(GradleProject.java:653)
at org.springsource.ide.eclipse.gradle.ui.wizards.GradleImportWizardPageOne$11.doit(GradleImportWizardPageOne.java:516)
at org.springsource.ide.eclipse.gradle.core.util.GradleRunnable.run(GradleRunnable.java:105)
... 1 more
Root exception:
org.springsource.ide.eclipse.gradle.core.InconsistenProjectHierarchyException: Gradle project hierarchy is inconsistent for '/home/ralmeida/workspace-collections/Collections'
at org.springsource.ide.eclipse.gradle.core.util.ExceptionUtil.inconsistentProjectHierachy(ExceptionUtil.java:82)
at org.springsource.ide.eclipse.gradle.core.GradleModelProvider$GroupedModelProvider.getCachedModel(GradleModelProvider.java:339)
at org.springsource.ide.eclipse.gradle.core.GradleProject.getGradleModel(GradleProject.java:634)
at org.springsource.ide.eclipse.gradle.core.GradleProject.getSkeletalGradleModel(GradleProject.java:653)
at org.springsource.ide.eclipse.gradle.ui.wizards.GradleImportWizardPageOne$11.doit(GradleImportWizardPageOne.java:516)
at org.springsource.ide.eclipse.gradle.core.util.GradleRunnable.run(GradleRunnable.java:105)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:122)

Eclipse IDE for Java EE Developers 4.4.1.20140925-1820
Gradle IDE 3.6.2.201410090835-RELEASE (configured to use gradle wrapper at http://services.gradle.org/distributions/gradle-2.1-bin.zip)

@BoykoAlex
Copy link
Contributor

Hmm... that worked just fine for me...

Check if the Gradle eclipse integration plugins in your Plug-in Registry view are these:
org.springsource.ide.eclipse.gradle.core (3.6.2.201410090835-RELEASE)
org.springsource.ide.eclipse.gradle.toolingapi (3.6.2.201410090835-RELEASE)
org.springsource.ide.eclipse.gradle.ui (3.6.2.201410090835-RELEASE)
org.springsource.ide.eclipse.gradle.ui.taskview (3.6.2.201410090835-RELEASE)

and also check if these are the ones that become active when you attempt to import your model.

Did you upgrade to Gradle 3.6.2 or installed STS 3.6.2 and then added Gradle to fresh installation of STS?

@i23098
Copy link
Author

i23098 commented Nov 10, 2014

I have version 3.6.2.201410090835-RELEASE of the plug-ins. Looking at the installation history, I started with regular eclipse Java EE 4.4 and installed Gradle IDE 3.5.1.201404300713-RELEASE. I got eclipse updated, and Gradle IDE 3.6.0.201407080553-RELEASE, and finally 3.6.2.201410090835-RELEASE.

@BoykoAlex
Copy link
Contributor

When you import the Gradle project into Eclipse, I assume you follow the import wizard, select Gradle Project and then find the folder on your file system where the Collections projects hierarchy is located. Once that is done you click on the "Build Model" button and then the exception occurs?
Is issue occurring all the time and blocking you completely? Looking at the code it's not yet clear why that issue is occurring... at least 100% of time.. perhaps there is a race condition, but it shouldn't be happening all the time it seems.

@i23098
Copy link
Author

i23098 commented Nov 10, 2014

Yes, import gradle project, when I press build model I got an error saying to look at the log. The exception was copy-pasted from the .log file. (Edit: Yes, it happens 100% of the time)

Since it worked for you, I just started with a clean install Eclipse Luna SR1, installed gradle plugin 3.62, new workspace with new git clone... And now it works. Maybe some problem in the upgrade process?

@BoykoAlex
Copy link
Contributor

We do get some issues on Gradle that occurred after upgrading Eclipse and Gradle eclipse plugin, but couldn’t pinpoint what exactly is going wrong… Every time it’s something different and very weird that has been tested before the release…

On Nov 10, 2014, at 15:55, i23098 [email protected] wrote:

Yes, import gradle project, when I press build model I got an error saying to look at the log. The exception was copy-pasted from the .log file.

Since it worked for you, I just started with a clean install Eclipse Luna SR1, installed gradle plugin 3.62, new workspace with new git clone... And now it works. Maybe some problem in the upgrade process?


Reply to this email directly or view it on GitHub #59 (comment).

@i23098
Copy link
Author

i23098 commented Nov 15, 2014

Got it again... For some reason Gradle -> Refresh All was not working. So, I decided to remove the projects from the workspace and import them again, to see if it helps. Now, it won't import it again...

!ENTRY org.springsource.ide.eclipse.gradle.core 4 0 2014-11-15 12:25:07.941
!MESSAGE Gradle project hierarchy is inconsistent for '/home/ralmeida/workspace-collections/Collections'
!STACK 0
java.lang.reflect.InvocationTargetException
    at org.springsource.ide.eclipse.gradle.core.util.GradleRunnable.run(GradleRunnable.java:113)
    at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:122)
Caused by: org.springsource.ide.eclipse.gradle.core.InconsistenProjectHierarchyException: Gradle project hierarchy is inconsistent for '/home/ralmeida/workspace-collections/Collections'
    at org.springsource.ide.eclipse.gradle.core.util.ExceptionUtil.inconsistentProjectHierachy(ExceptionUtil.java:82)
    at org.springsource.ide.eclipse.gradle.core.GradleModelProvider$GroupedModelProvider.getCachedModel(GradleModelProvider.java:339)
    at org.springsource.ide.eclipse.gradle.core.GradleProject.getGradleModel(GradleProject.java:634)
    at org.springsource.ide.eclipse.gradle.core.GradleProject.getSkeletalGradleModel(GradleProject.java:653)
    at org.springsource.ide.eclipse.gradle.ui.wizards.GradleImportWizardPageOne$11.doit(GradleImportWizardPageOne.java:516)
    at org.springsource.ide.eclipse.gradle.core.util.GradleRunnable.run(GradleRunnable.java:105)
    ... 1 more
Root exception:
org.springsource.ide.eclipse.gradle.core.InconsistenProjectHierarchyException: Gradle project hierarchy is inconsistent for '/home/ralmeida/workspace-collections/Collections'
    at org.springsource.ide.eclipse.gradle.core.util.ExceptionUtil.inconsistentProjectHierachy(ExceptionUtil.java:82)
    at org.springsource.ide.eclipse.gradle.core.GradleModelProvider$GroupedModelProvider.getCachedModel(GradleModelProvider.java:339)
    at org.springsource.ide.eclipse.gradle.core.GradleProject.getGradleModel(GradleProject.java:634)
    at org.springsource.ide.eclipse.gradle.core.GradleProject.getSkeletalGradleModel(GradleProject.java:653)
    at org.springsource.ide.eclipse.gradle.ui.wizards.GradleImportWizardPageOne$11.doit(GradleImportWizardPageOne.java:516)
    at org.springsource.ide.eclipse.gradle.core.util.GradleRunnable.run(GradleRunnable.java:105)
    at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:122)

@kdvolder
Copy link
Contributor

The error means that gradle tooling is having problem creating a tooling api model for a project via its root project. This happens when some stored information in the project preference area links a given project to a root project, but when building a model for the root project then it can not find the project as a descendant of the root project.

Maybe the project hierarchy changed? Or maybe there is some problem in your settings.gradle defining sub-projects for your root project.

Before importing the project try maybe deleting the settings files in the .settings/gradle folder (this is where the information is stored). I suggest you try to delete all these .settings/gradle files in all your projects and then try importing them again.

@guramritpal-singh
Copy link

This problem comes when the local version and project which has version.is different.

Basically every project has on task in build.gradle file called wrapper. This wraaper defines which version of gradle had been used in this project which is in gradle.properties.
When you have local version diifenernce and the version defined bye gradle wrapper is different then problms come.

Advice better to use same version by looking into gradle.properites file or use the project provided gradlew command which is going to download a gradle version required by project.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

4 participants