Eclipse 放弃增量构建并系统地进行全面清理和重建

问题描述 投票:0回答:1

版本:适用于 Java 开发人员的 Eclipse 2024-03(但也尝试过旧版本的 Eclipse,都存在相同的问题)

这个问题似乎只发生在大型项目上。

以下设置已激活:

  • Windows -> 首选项 -> 运行/调试 -> 启动 -> 启动前构建(如果需要)
  • 项目 -> 自动构建

我遇到了以下问题:

  • 当我希望利用增量构建时,对文件进行最轻微的编辑就会触发完全清理和重建。
  • 启动单元测试或主程序会触发完全清理和重建,即使没有任何更改。更糟糕的是,一旦构建完成并运行执行,就会在后台触发新的完全清理和重建,并导致 NoClassDefFoundError 随机类。
  • 构建恰好陷入清理和重建的无限循环中。

重要提示:我不使用任何集成构建工具,例如 buildship (Gradle) 或 m2e (Maven)。

编辑

这是较大项目的

.project
文件:

<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
    <name>myproject</name>
    <comment/>
    <projects/>
    <natures>
        <nature>org.eclipse.jdt.core.javanature</nature>
        <nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
    </natures>
    <buildSpec>
        <buildCommand>
            <name>org.eclipse.jdt.core.javabuilder</name>
            <arguments/>
        </buildCommand>
    </buildSpec>
    <linkedResources/>
</projectDescription>

编辑

类路径文件:

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
  <classpathentry including="**/*" kind="src" path="src/main/java"/>
  <classpathentry including="**/*" kind="src" path="src/main/resources/etc"/>
  <classpathentry excluding="etc/**" including="**/*" kind="src" path="src/main/resources"/>
  <classpathentry kind="src" output="build/classes/test" path="src/test/java">
    <attributes>
      <attribute name="test" value="true"/>
    </attributes>
  </classpathentry>
  <classpathentry kind="src" output="build/classes/test" path="src/test/resources">
    <attributes>
      <attribute name="test" value="true"/>
    </attributes>
  </classpathentry>
  <classpathentry exported="true" kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
  <classpathentry exported="true" kind="lib" path="/path/to/some-library.jar" sourcepath="/path/to/some-library-sources.jar">
    <attributes>
      <attribute name="org.eclipse.jst.component.dependency" value="../"/>
    </attributes>
  </classpathentry>
  <!-- skipped other lib entries similar to this one -->
  <classpathentry kind="output" path="build/classes/main"/>
</classpath>
eclipse eclipse-jdt
1个回答
0
投票

这与项目的结构有关:

root
+---extensions
    +---projects
        +---some-project

树中的所有项目都是通用项目,除了 some-project 是一个 Java 项目。

当我从工作区中删除项目根目录时,问题就消失了。 当我将其添加回工作区时,问题再次出现。

我在工作区中只能将 root 作为 General Project,将 some-project 作为 Java Project。 但即使有了这两个,我仍然有问题。

此外,我尝试添加资源过滤器以从根目录中排除“some-project”,但没有帮助。 即使关闭根项目也没有帮助,只有删除它才有帮助。

此处的错误报告:https://github.com/eclipse-jdt/eclipse.jdt.ui/issues/1347

© www.soinside.com 2019 - 2024. All rights reserved.