MPECLIPSE-36 JUnit jar not add in a specific condition

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@115939 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
epugh
2004-08-09 14:28:15 +00:00
parent 953bb7ced0
commit 41215bebdb
4 changed files with 20 additions and 7 deletions

View File

@@ -64,7 +64,8 @@
<maven:makeRelativePath var="srcDir" basedir="${basedir}" path="${res}" />
<classpathentry kind="src" path="${srcDir}"/>
</j:forEach>
<!-- 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}"/>
@@ -105,6 +106,7 @@
</j:if>
<j:if test="${depVersion != 'none'}">
<j:set var="ignoreJUnit" value="true" />
<classpathentry kind="var" path="MAVEN_REPO/junit/jars/junit-${depVersion}.jar"/>
</j:if>
</j:if>
@@ -135,7 +137,7 @@
<j:when test="${eclipseDependency == 'false'}">
<!-- ignore specific dependencies -->
</j:when>
<j:when test="${lib.dependency.groupId == 'junit'}">
<j:when test="${lib.dependency.groupId == 'junit' and ignoreJUnit}">
<!-- ignoring junit dependency as we've already created it -->
</j:when>
<j:otherwise>

View File

@@ -28,17 +28,22 @@
<j:set var="dotClasspath" value="${basedir}/.classpath"/>
</goal>
<goal name="test-eclipse">
<goal name="test-eclipse" prereqs="test-init">
<delete file="${dotProject}" failonerror="false"/>
<delete file="${dotClasspath}" failonerror="false"/>
<attainGoal name="eclipse"/>
<assert:assertFileExists file="${dotProject}" />
<assert:assertFileExists file="${dotClasspath}" />
<u:file var="classpathFile" name="${dotClasspath}"/>
<x:parse var="classpathDoc" xml="${classpathFile.toURL()}" />
<x:set var="count" select="count($classpathDoc/classpath/classpathentry[contains(@path,'MAVEN_REPO/junit/jars/junit-3.8.1.jar')])"/>
<assert:assertEquals expected="1" value="${count.intValue().toString()}" msg="JUnit dependency not found"/>
</goal>
<goal name="test-natures">
<goal name="test-natures" prereqs="test-init">
<delete file="${dotProject}" failonerror="false"/>
<j:set var="maven.eclipse.projectnatures" value="n1,a.b.c.n2"/>
<attainGoal name="eclipse:generate-project"/>
@@ -52,7 +57,7 @@
<assert:assertEquals expected="a.b.c.n2" value="${natures[2].text}" msg="a.b.c.n2 is not the third nature"/>
</goal>
<goal name="test-builders">
<goal name="test-builders" prereqs="test-init">
<j:set var="maven.eclipse.buildcommands" value="c1,c2,c3"/>
<delete file="${dotProject}" failonerror="false"/>
<attainGoal name="eclipse:generate-project"/>
@@ -68,7 +73,7 @@
</goal>
<goal name="test-natures-and-builders">
<goal name="test-natures-and-builders" prereqs="test-init">
<delete file="${dotProject}" failonerror="false"/>
<j:set var="maven.eclipse.projectnatures" value="n7,n9,n11"/>
<j:set var="maven.eclipse.buildcommands" value="c11,c21,c31"/>
@@ -91,7 +96,7 @@
<assert:assertEquals expected="c31" value="${builders[3].text}" msg="c31 is not the second build command name"/>
</goal>
<goal name="test-classpath-has-generated-source">
<goal name="test-classpath-has-generated-source" prereqs="test-init">
<delete file="${dotProject}" failonerror="false"/>
<delete file="${dotClasspath}" failonerror="false"/>
<mkdir dir="${maven.gen.src}/gensrc1"/>

View File

@@ -58,5 +58,10 @@
<artifactId>commons-jelly-tags-xml</artifactId>
<version>20030211.142705</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
</dependency>
</dependencies>
</project>

View File

@@ -25,6 +25,7 @@
</properties>
<body>
<release version="1.8" date="In CVS">
<action dev="epugh" type="fix" issue="MPECLIPSE-36" due-to="Felipe Leme">Fixed a 'race condition' where JUnit dependency is not added to .classpath.</action>
<action dev="epugh" type="add">Add maven.gen.src property that points to a directory whose subdirectories are included as separate source directories.</action>
<action dev="epugh" type="add" issue="MPECLIPSE-10" due-to="Thierry Lack">Set eclipse.dependency=false to explicity ignore dependencies in classpath generation</action>
<action dev="evenisse" type="fix" issue="MPECLIPSE-29" due-to="Marc-Antoine Garrigue">Fix classpath generation when tests are not present</action>