Eclipse Buildship Plugin:嵌套源文件夹



我正在使用Gradle Buildship插件来构建我的Eclipse项目。

Gradle本身已经配置好了。因此,我可以从shell构建任何东西。

gradle项目有一个根文件夹和其他子项目。

当我点击Gradle -> Refresh Project时它告诉我:

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)

唯一对我有效的是取消勾选"允许为源文件夹输出文件夹"选项。

步骤:

    右键单击项目->属性
  1. 单击属性弹出窗口左侧的Java Build Path
  2. 点击Source选项卡
  3. 取消选中"允许输出文件夹为源文件夹"复选框
  4. 点击应用并关闭
  5. 右键单击project -> Gradle -> Refresh Gradle project

我也遇到过这个问题。我的解决方案是设置项目属性。

在Java build Path -> Source中,将输出文件夹设置为default。有关更多细节,请参阅下图。

Project Properties -> Java build path -> Source

源文件夹输出位置

相关内容

  • 没有找到相关文章

最新更新