类路径构建顺序更改

发布于 2024-09-29 04:34:25 字数 887 浏览 2 评论 0原文

我在 OS X Snow Leopard 上使用 Eclipse 3.5 Java EE 64 位。

想知道每次运行标准 Ant 构建脚本时 .classpath 文件的标记顺序如何更改。

当我像这样手动更改构建路径顺序时(通过 Eclipse):

  1. 右键单击 Project Explorer 中的项目。

  2. 打开上下文菜单

  3. 转到构建路径

  4. 配置构建路径

  5. 单击Java 构建路径顺序和导出选项卡

  6. 将顺序修改为如下所示:

    • myproject/work/src(将其移至顶部)
    • 我的项目/工作/测试/单元
    • myproject/work/impl/src

(myproject/work/impl/src 是链接的资源指向一个 在 Eclipse 中打开的第二个 Eclipse 项目 同时)

myproject/work/impl/src 默认位于订单的第一个位置。 手动将 myproject/work/src 移动到顶部(通过单击“向上”按钮)。

当我运行构建脚本时,.classpath 文件(此命令在幕后写入)似乎被重置为之前的状态:

这是为什么呢? Eclipse 在何时何地修改 .classpath 文件?如何设置才能让人们可以通过 Eclipse 手动更改构建顺序,但 .classpath 的构建顺序永远不会重置为其默认值?设置此选项并通过右键单击我的项目(不是 impl 项目)并转到“构建项目”来构建项目后,顺序永远不会改变。它仅在 Ant 构建脚本运行时重置。

I am using Eclipse 3.5 Java EE 64 bit on OS X Snow Leopard.

Was wondering how the .classpath file's tag's order gets changed everytime I run a standard Ant build script.

When I manually change the build path order like this (via Eclipse):

  1. Right click on project in Project Explorer.

  2. A context menu opens up

  3. Go to Build Path

  4. Configure Build Path

  5. Click on the Java Build Path Order and Export Tab

  6. Modified the order to look like this:

    • myproject/work/src (moved this to the top)
    • myproject/work/test/unit
    • myproject/work/impl/src

(The myproject/work/impl/src is a linked resource which points to a
2nd Eclipse project which is open in Eclipse
at the same time)

The myproject/work/impl/src by default is at the first position for the order.
Manually moved myproject/work/src to the top (by clicking on the Up button).

When I run my build script, it seems that the .classpath file (which this order is written to behind-the-scenes) is reset to how it was before:

Why is this? Where and when does Eclipse modify the .classpath file? How can it be set so people can change the build order manually through Eclipse but the .classpath's build order never gets reset to its defaults? After setting this and building the project by right mouse clicking on my project (not the impl one) and going to Build Project, the order never gets changed. It only resets when the Ant build script is run.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

半枫 2024-10-06 04:34:25

Eclipse 何时何地修改
.classpath 文件?

每当类路径更改时。

您的问题可能因多种原因而发生。首先想到的一些问题包括:

  1. 修改顺序后未单击“确定”(不太可能)
  2. .classpath 文件已更改但未在视图中刷新(选择根项目文件夹并按 F5)
  3. 您的 ant 文件本身是更改/设置类路径
  4. 插件之一(在 ant 构建过程中使用)修改类路径

似乎#3 最有可能。

Where and when does Eclipse modify the
.classpath file?

Whenever the classpath is changed.

Your problem could be occurring for any number of reasons. Some of the ones that come to mind first include:

  1. not clicking 'ok' after modifying the order (unlikely)
  2. the .classpath file is changed but not refreshed in the view (select the root project folder and hit F5)
  3. your ant file itself is changing/setting the classpath
  4. one of the plugins (used during your ant build process) modifies the classpath

It seems #3 is most likely.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文