fix MPECLIPSE-51: check if src and test resources/dir doesn't cause duplicated src entries

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@116158 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
felipeal committed 2004-10-22 05:40:54 +00:00
1 parent 297e84ca43
commit 21836402c1
5 files changed
+29 -7

No files matched your search

+10
View File
@@ -85,5 +85,15 @@
<role>Java Developer</role>
</roles>
</developer>
<developer>
<name>Felipe Leme</name>
<id>felipeal</id>
<email>maven@felipeal.net</email>
<organization>Falcon Informatica</organization>
<roles>
<role>Java Developer</role>
<role>Jelly Developer</role>
</roles>
</developer>
</developers>
</project>
@@ -36,6 +36,10 @@
</j:forEach>
</u:available>
<j:if test="${unitTestSourcesPresent}">
<ant:echo>Contains JUnit tests</ant:echo>
<maven:makeRelativePath var="testSrcDir" basedir="${basedir}" path="${pom.build.unitTestSourceDirectory}" separator="/"/>
</j:if>
<j:if test="${sourcesPresent}">
<maven:makeRelativePath var="srcDir" basedir="${basedir}" path="${pom.build.sourceDirectory}" separator="/"/>
<j:set var="excluding" value=""/>
@@ -68,7 +72,7 @@
</j:forEach>
<maven:makeRelativePath var="resourceDirectory" basedir="${basedir}" path="${resource.directory}" separator="/"/>
<!-- don't add duplicate directories -->
<j:if test="${!resourceDirectory.equals(srcDir)}">
<j:if test="${!resourceDirectory.equals(srcDir) and (!resourceDirectory.equals(testSrcDir) or !unitTestSourcesPresent)}">
<classpathentry kind="src" path="${resourceDirectory}" including="${includingAsString}" excluding="${excludingAsString}" />
</j:if>
</j:forEach>
@@ -86,8 +90,6 @@
<!-- set a flag so JUnit jar is included only once -->
<j:set var="ignoreJUnit" value="false" />
<j:if test="${unitTestSourcesPresent}">
<ant:echo>Contains JUnit tests</ant:echo>
<maven:makeRelativePath var="testSrcDir" basedir="${basedir}" path="${pom.build.unitTestSourceDirectory}" separator="/"/>
<!-- Eclipse supports an output directory per input directory -->
<j:set var="testOutputDir" value="${maven.eclipse.test.output.dir}"/>
@@ -146,7 +148,7 @@
</j:forEach>
<maven:makeRelativePath var="resourceDirectory" basedir="${basedir}" path="${resource.directory}" separator="/"/>
<!-- don't add duplicate directories -->
<j:if test="${!resourceDirectory.equals(testSrcDir)}">
<j:if test="${!resourceDirectory.equals(testSrcDir) and (!resourceDirectory.equals(srcDir) or !sourcesPresent)}">
<classpathentry kind="src" path="${resourceDirectory}" output="${testOutputDir}" including="${includingAsString}" excluding="${excludingAsString}"/>
</j:if>
</j:forEach>
+6 -3
View File
@@ -111,10 +111,11 @@
<u:file var="classpathFile" name="${dotClasspath}"/>
<x:parse var="classpathDoc" xml="${classpathFile.toURL()}" />
<x:set var="count" select="count($classpathDoc/classpath/classpathentry[contains(@kind,'src')])"/>
<!--
<assert:assertEquals expected="6" value="${count.intValue().toString()}" msg="Wrong number of generated src directories found"/>
-->
</goal>
<goal name="test-classpath-has-overridden-jar">
<attainGoal name="test-init"/>
<attainGoal name="eclipse"/>
@@ -138,8 +139,10 @@
<u:file var="classpathFile" name="${dotClasspath}"/>
<x:parse var="classpathDoc" xml="${classpathFile.toURL()}" />
<x:set var="countUniqueSrc" select="count($classpathDoc/classpath/classpathentry[contains(@path,'src/main')])"/>
<x:set var="countUniqueSrc" select="count($classpathDoc/classpath/classpathentry[ends-with(@path,'src/main')])"/>
<assert:assertEquals expected="1" value="${countUniqueSrc.intValue().toString()}" msg="Src directory should be added only once"/>
<x:set var="countUniqueSrcTest" select="count($classpathDoc/classpath/classpathentry[ends-with(@path,'src/test')])"/>
<assert:assertEquals expected="1" value="${countUniqueSrcTest.intValue().toString()}" msg="Test directory should be added only once"/>
</goal>
<goal name="test-classpath-con-entry">
+6
View File
@@ -93,6 +93,9 @@
<directory>src/test-resources</directory>
<filtering>false</filtering>
</resource>
<resource>
<directory>src/main</directory>
</resource>
</resources>
</unitTest>
<resources>
@@ -107,6 +110,9 @@
</includes>
<filtering>false</filtering>
</resource>
<resource>
<directory>src/test</directory>
</resource>
</resources>
</build>
</project>
+1
View File
@@ -25,6 +25,7 @@
</properties>
<body>
<release version="1.9" date="in cvs">
<action dev="felipeal" type="fix" issue="MPECLIPSE-51">Fixed duplicated source entry issue.</action>
<action dev="epugh" type="add">add property maven.eclipse.addResources=false to prevent the build resources from breaking old Eclipse builds.</action>
<action dev="epugh" type="add">Allow includes/excludes in build resources to be used in the classpath generation.</action>
<action dev="epugh" type="add" issue="MPECLIPSE-50" due-to="Simon Ringuette">Support for Eclipse-Plugin maven projects (or kind="con" classpath).</action>