Details
-
Type:
Improvement
-
Status:
Closed
-
Priority:
Major
-
Resolution: Incomplete
-
Affects Version/s: None
-
Fix Version/s: 1.8
-
Component/s: None
-
Labels:None
-
Number of attachments :
Description
The attached file contains two hacks to the generation of the classpath in the eclipse:generate-classpath plug-in:
1. Added the source directory for the integration unit tests.
(TODO: add cactus JARs to the classpath)
2. Add JARs only once (using a Set), this is useful when you have a junit in the dependencies (or may be in the future when you have the cactus libs)
Thanks Diego, great stuff. I think we should "upgrade" the plugin to support the exclude and the "compile to different folders" feature which is introduced in Eclipse 2.1.
The "child" containing the source dir could look something like this:
<j:if test="${sourcesPresent}">
<classpathentry kind="src" excluding="**/Test" output="${outputDir}" path="${pom.build.sourceDirectory}"/>
</j:if>
And the "child" containing the unit test could look something like this:
<!-- Must be defined the same place as var="outputDir" etc. -->
<j:set var="outputDirTest" value="${maven.eclipse.outputtest.dir}"/>
<j:if test="${empty outputDirTest}">
<j:set var="outputDirTest" value="target/test-classes"/>
</j:if>
<j:if test="${unitTestSourcesPresent}">
<j:forEach var="exclude" items="${pom.build.unitTest.excludes}">
<j:set var="excluding" value="${excluding}|${exclude}"/>
</j:forEach>
<classpathentry kind="src" excluding="${excluding.substring(1)}" output="${outputDirTest}" path="${pom.build.unitTestSourceDirectory}"/>
//Damn - it's a bit hacked - bette look into Jelly.
//Here comes the rest of your patch
...
</j:if>
It might also be usefull to support the pom.build.resources - like creating another leaf to the goal - the code below could be a starting point - but it's not working correctly.
<j:if test="${!pom.build.resources.isEmpty()}">
<j:forEach var="dir" items="${pom.build.resources.dirs}">
<classpathentry kind="src" output="${outputDir}" path="${dir}"/>
</j:forEach>
</j:if>
And aging the "leaf" should support the exclude feature like the unittest "leaf" - look above. By the way is there a better way to get the name/location of each resource directory than shown above?
Best regards,
Jens Andersen