Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse combining multiple classpathentry hierarchically into the same output

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.
like image 898
Blessed Geek Avatar asked Nov 03 '22 13:11

Blessed Geek


1 Answers

First of all, .classpath is not intended to be edited manually. This file is configuration file of JDT. Files with names starting with "." are intended to hidden from User. If you edited this file manually, in some cases, there will be broken synchronization with actual configuration object (JDT is okay, since configurations are automatically synchronized in JDT)

Open Properties Dialog of your project, select "Java Build Path". Then you can see GUI editor for that file. That GUI will answer what you asked. It allows to manage src to output mapping, re-ordering and etc. But it will not help you nest output the way you asked.

An output folder cannot be hierarchically nested under another other output folder. Because there may cause conflicts. I am sure syntax will not help you. It will not let you do what you intend.

This file is just derived stored data. If your needs are strong, you should have to consider custom build script, or hire some eclipse engineer to make builder extension for your needs.

like image 129
jeeeyul Avatar answered Nov 08 '22 08:11

jeeeyul