Eclipse Buildship Plugin: nesting source folders
Asked Answered
H

2

7

I'm using Gradle Buildship plugin in order to build my Eclipse projects.

Gradle itselft is well configured. So, I'm able to build anything from shell.

The gradle project has a root folder and other subprojects.

When I click on Gradle -> Refresh Project it tells me:

Synchronize Gradle builds with workspace failed due to an unexpected error.
Cannot nest 'living_webapi/src/main/java/com/living/persistence/entities' inside 'living_webapi/src/main/java'. To enable the nesting exclude 'com/' from 'living_webapi/src/main/java'
Java Model Exception: Java Model Status [Cannot nest 'living_webapi/src/main/java/com/living/persistence/entities' inside 'living_webapi/src/main/java'. To enable the nesting exclude 'com/' from 'living_webapi/src/main/java']
    at org.eclipse.jdt.internal.core.JavaModelOperation.runOperation(JavaModelOperation.java:786)
    at org.eclipse.jdt.internal.core.JavaProject.setRawClasspath(JavaProject.java:3097)
    at org.eclipse.jdt.internal.core.JavaProject.setRawClasspath(JavaProject.java:3059)
    at org.eclipse.jdt.internal.core.JavaProject.setRawClasspath(JavaProject.java:3112)
    at org.eclipse.buildship.core.workspace.internal.SourceFolderUpdater.updateClasspath(SourceFolderUpdater.java:234)
    at org.eclipse.buildship.core.workspace.internal.SourceFolderUpdater.updateClasspath(SourceFolderUpdater.java:82)
    at org.eclipse.buildship.core.workspace.internal.SourceFolderUpdater.update(SourceFolderUpdater.java:261)
    at org.eclipse.buildship.core.workspace.internal.SynchronizeGradleBuildOperation.synchronizeOpenJavaProject(SynchronizeGradleBuildOperation.java:223)
    at org.eclipse.buildship.core.workspace.internal.SynchronizeGradleBuildOperation.synchronizeOpenWorkspaceProject(SynchronizeGradleBuildOperation.java:213)
    at org.eclipse.buildship.core.workspace.internal.SynchronizeGradleBuildOperation.synchronizeWorkspaceProject(SynchronizeGradleBuildOperation.java:186)
    at org.eclipse.buildship.core.workspace.internal.SynchronizeGradleBuildOperation.synchronizeGradleProjectWithWorkspaceProject(SynchronizeGradleBuildOperation.java:176)
    at org.eclipse.buildship.core.workspace.internal.SynchronizeGradleBuildOperation.synchronizeGradleBuildWithWorkspace(SynchronizeGradleBuildOperation.java:141)
    at org.eclipse.buildship.core.workspace.internal.SynchronizeGradleBuildOperation.access$000(SynchronizeGradleBuildOperation.java:106)
    at org.eclipse.buildship.core.workspace.internal.SynchronizeGradleBuildOperation$1.run(SynchronizeGradleBuildOperation.java:123)
    at org.eclipse.jdt.internal.core.BatchOperation.executeOperation(BatchOperation.java:39)
    at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:724)
    at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2240)
    at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2267)
    at org.eclipse.jdt.core.JavaCore.run(JavaCore.java:5521)
    at org.eclipse.jdt.core.JavaCore.run(JavaCore.java:5478)
    at org.eclipse.buildship.core.workspace.internal.SynchronizeGradleBuildOperation.run(SynchronizeGradleBuildOperation.java:120)
    at org.eclipse.buildship.core.workspace.internal.SynchronizeGradleBuildsJob.synchronizeBuild(SynchronizeGradleBuildsJob.java:78)
    at org.eclipse.buildship.core.workspace.internal.SynchronizeGradleBuildsJob.runToolingApiJob(SynchronizeGradleBuildsJob.java:69)
    at org.eclipse.buildship.core.util.progress.ToolingApiJob$1.run(ToolingApiJob.java:73)
    at org.eclipse.buildship.core.util.progress.ToolingApiInvoker.invoke(ToolingApiInvoker.java:62)
    at org.eclipse.buildship.core.util.progress.ToolingApiJob.run(ToolingApiJob.java:70)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Hedger answered 13/9, 2016 at 9:2 Comment(0)
M
5

The only thing that worked for me was un-checking the "Allow output folders for source folders" option.

Steps:

  1. Right click on project -> Properties
  2. Click on Java Build Path in the left side of Properties popup
  3. Click on Source tab
  4. Un-check the "Allow output folders for source folders" checkbox
  5. Click Apply and Close
  6. Right click on project -> Gradle -> Refresh Gradle Project
Mustachio answered 17/11, 2019 at 12:25 Comment(0)
S
1

I got this problem too. My solution is setting project properties.

In Java build Path -> Source,set output folder to default. For more detail,the image below.

Project Properties -> Java build path -> Source

Source folder output location

Selfpity answered 22/2, 2018 at 2:55 Comment(2)
add some descriptionMuffin
When I try to refresh gradle project had the same problem. I try to reset the project properties in eclipse.Like the img in my post. After I set to use default,I can refresh gradle project.The URL above is a image.Selfpity

© 2022 - 2025 — McMap. All rights reserved.