eclipse / buildship

The Eclipse Plug-ins for Gradle project.
534 stars 172 forks source link

Java Model Exception: Java Model Status [Cannot nest importing a gradle project working on IntelliJ Idea #987

Open aleroot opened 4 years ago

aleroot commented 4 years ago

This morning I've tried to load a multi module gradle project perfectly working on IntelliJ Idea 2020.1 with the gradle setting: "Generate IntelliJ IDEA module per gradle source set" unticked, and this is the error I get:

Java Model Exception: Java Model Status [Cannot nest 'ExternalServicesTests/src/test/java' inside 'ExternalServicesTests/src/test'. To enable the nesting exclude 'java/' from 'ExternalServicesTests/src/test']
    at org.eclipse.jdt.internal.core.JavaModelOperation.runOperation(JavaModelOperation.java:798)
    at org.eclipse.jdt.internal.core.JavaProject.setRawClasspath(JavaProject.java:3573)
    at org.eclipse.jdt.internal.core.JavaProject.setRawClasspath(JavaProject.java:3533)
    at org.eclipse.jdt.internal.core.JavaProject.setRawClasspath(JavaProject.java:3589)
    at org.eclipse.buildship.core.internal.workspace.SourceFolderUpdater.updateSourceFolders(SourceFolderUpdater.java:71)
    at org.eclipse.buildship.core.internal.workspace.SourceFolderUpdater.update(SourceFolderUpdater.java:169)
    at org.eclipse.buildship.core.internal.workspace.BaseConfigurator.synchronizeJavaProjectInTransaction(BaseConfigurator.java:116)
    at org.eclipse.buildship.core.internal.workspace.BaseConfigurator.access$000(BaseConfigurator.java:40)
    at org.eclipse.buildship.core.internal.workspace.BaseConfigurator$1.run(BaseConfigurator.java:105)
    at org.eclipse.jdt.internal.core.BatchOperation.executeOperation(BatchOperation.java:41)
    at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:736)
    at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2292)
    at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2317)
    at org.eclipse.jdt.core.JavaCore.run(JavaCore.java:5890)
    at org.eclipse.jdt.core.JavaCore.run(JavaCore.java:5847)
    at org.eclipse.buildship.core.internal.workspace.BaseConfigurator.synchronizeJavaProject(BaseConfigurator.java:101)
    at org.eclipse.buildship.core.internal.workspace.BaseConfigurator.configure(BaseConfigurator.java:91)
    at org.eclipse.buildship.core.internal.workspace.BaseConfigurator.configure(BaseConfigurator.java:66)
    at org.eclipse.buildship.core.internal.extension.InternalProjectConfigurator.configure(InternalProjectConfigurator.java:65)
    at org.eclipse.buildship.core.internal.workspace.ProjectConfigurators.configureConfigurators(ProjectConfigurators.java:68)
    at org.eclipse.buildship.core.internal.workspace.SynchronizeGradleBuildOperation.synchronizeOpenWorkspaceProject(SynchronizeGradleBuildOperation.java:163)
    at org.eclipse.buildship.core.internal.workspace.SynchronizeGradleBuildOperation.addNewEclipseProjectToWorkspace(SynchronizeGradleBuildOperation.java:197)
    at org.eclipse.buildship.core.internal.workspace.SynchronizeGradleBuildOperation.synchronizeNonWorkspaceProject(SynchronizeGradleBuildOperation.java:179)
    at org.eclipse.buildship.core.internal.workspace.SynchronizeGradleBuildOperation.synchronizeGradleProjectWithWorkspaceProject(SynchronizeGradleBuildOperation.java:130)
    at org.eclipse.buildship.core.internal.workspace.SynchronizeGradleBuildOperation.access$000(SynchronizeGradleBuildOperation.java:42)
    at org.eclipse.buildship.core.internal.workspace.SynchronizeGradleBuildOperation$1.run(SynchronizeGradleBuildOperation.java:85)
    at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2292)
    at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2312)
    at org.eclipse.buildship.core.internal.workspace.SynchronizeGradleBuildOperation.synchronizeProjectsWithWorkspace(SynchronizeGradleBuildOperation.java:82)
    at org.eclipse.buildship.core.internal.workspace.SynchronizeGradleBuildOperation.run(SynchronizeGradleBuildOperation.java:64)
    at org.eclipse.buildship.core.internal.DefaultGradleBuild$SynchronizeOperation.runInToolingApi(DefaultGradleBuild.java:230)
    at org.eclipse.buildship.core.internal.operation.DefaultToolingApiOperationManager$WorkspaceRunnableAdapter.run(DefaultToolingApiOperationManager.java:58)
    at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2292)
    at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2317)
    at org.eclipse.buildship.core.internal.operation.DefaultToolingApiOperationManager.run(DefaultToolingApiOperationManager.java:39)
    at org.eclipse.buildship.core.internal.DefaultGradleBuild$SynchronizeOperation.run(DefaultGradleBuild.java:192)
    at org.eclipse.buildship.core.internal.DefaultGradleBuild.synchronize(DefaultGradleBuild.java:100)
    at org.eclipse.buildship.ui.internal.wizard.project.ProjectImportWizardController$5.run(ProjectImportWizardController.java:213)
    at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:122)

Gradle version: 6.2.2 OS: Fedora 32 x86-64

donat commented 3 years ago

Is there a .classpath file already present in the project when you imported it? Removing it should resolve issue.

If that's not the case, I'd need a minimal example project to investigate further.