5

I have the following records in my projects's .classpath file:

<classpathentry kind="src" path="src/main/webapp"
 output="build/webapp"/>
<classpathentry kind="src" path="src/main/java"
 output="build/webapp/WEB-INF/classes"/>
<classpathentry kind="src" path="src/main/resources"
 output="build/webapp/WEB-INF/classes"/>

My intention is

  1. copy src/main/webapp into build/webapp
  2. then compile src/main/java into build/webapp/WEB-INF/classes
  3. then copy src/main/resources into build/webapp/WEB-INF/classes

However the result is actually,

  • copy src/main/webapp into build/webapp
  • prevent build/webapp/WEB-INF/classes from ever existing, but maintain the exact copy between src/main/webapp and build/webapp

Which means build/webapp/WEB-INF/classes can never be created and steps 2 & 3 never successful.

I even tried modifying step 1 to

<classpathentry kind="src" path="src/main/webapp" output="build/webapp"
 excluding="WEB-INF/classes/**"/>

which did not help at all.

The order of the classpathentry records are inconsequential.

Q1. Please help advise how I should write my classpathentry records to hierarchically combine them into the same output directory, so that a classpathentry of a higher folder hierarchy would not nullify a classpathentry of a lower folder hierarchy.

Q2. BTW, I cannot find any document specification for the xml tags and tag-attributes for eclipse .classpath file. I have tried googling "eclipse classpathentry" to no avail. Could someone also point me to a document?

  • Are "exported", "excluding", "kind", "path", "output" the only attributes for the classpathentry tag?
  • What other tags are allowed in the .classpath file, for example?
  • A functional explanation for each of those tags and tag-attributes.
4

1 回答 1

2

首先,.classpath 不打算手动编辑。该文件是 JDT 的配置文件。名称以“.”开头的文件 旨在对用户隐藏。如果您手动编辑此文件,在某些情况下,与实际配置对象的同步会中断(JDT 可以,因为配置会在 JDT 中自动同​​步)

打开项目的属性对话框,选择“Java Build Path”。然后您可以看到该文件的 GUI 编辑器。该 GUI 将回答您的要求。它允许管理 src 以输出映射、重新排序等。但它不会帮助您按照您要求的方式嵌套输出。

一个输出文件夹不能分层嵌套在另一个其他输出文件夹下。因为有可能会引起冲突。我相信语法不会帮助你。它不会让你做你想做的事。

该文件只是派生存储的数据。如果您的需求很强烈,您应该考虑自定义构建脚本,或者聘请一些 Eclipse 工程师来为您的需求制作构建器扩展。

于 2012-11-01T01:24:11.077 回答