Reuse Jelly script via tag. Other stylistic fixes.

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@116145 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
epugh committed 2004-10-15 18:08:29 +00:00
1 parent c87a62187b
commit 868701da84
2 files changed
+36 -42

No files matched your search

+27 -5
View File
@@ -22,12 +22,34 @@
xmlns:j="jelly:core"
xmlns:ant="jelly:ant"
xmlns:test="test"
xmlns:cactus="cactus"
xmlns:util="jelly:util">
xmlns:util="jelly:util"
xmlns:define="jelly:define"
xmlns:maven="jelly:maven">
<!-- FIXME: remove and use maven:get -->
<test:dependency-handle/>
<cactus:dependency-handle/>
<define:taglib uri="eclipse">
<define:tag name="write-classpath-entry">
<maven:param-check value="${groupId}" fail="true" message="'groupId' must be specified"/>
<maven:param-check value="${artifactId}" fail="true" message="'artifactId' must be specified"/>
<maven:param-check value="${version}" fail="true" message="'version' must be specified"/>
<!-- relativePath is optional, used for jar override -->
<j:set var="relativePathCheck" value="${relativePath}X" />
<j:if test='${relativePathCheck == "X"}'>
<j:set var="relativePath" value="${groupId}/jars/${artifactId}-${version}.jar" />
</j:if>
<j:set var="mappedsrc" value="${groupId}/src/${artifactId}-${version}.${maven.eclipse.src.extension}"/>
<util:file var="checkSrcExist" name="${maven.repo.local}/${mappedsrc}" />
<j:choose>
<j:when test="${checkSrcExist.exists()}">
<classpathentry kind="var" path="MAVEN_REPO/${relativePath}" sourcepath="MAVEN_REPO/${mappedsrc}" />
</j:when>
<j:otherwise>
<classpathentry kind="var" path="MAVEN_REPO/${relativePath}" />
</j:otherwise>
</j:choose>
</define:tag>
</define:taglib>
<!--==================================================================-->
<!-- Generate Eclipse .project and .classpath files -->
@@ -22,6 +22,7 @@
xmlns:ant="jelly:ant"
xmlns:maven="jelly:maven"
xmlns:u="jelly:util"
xmlns:eclipse="eclipse"
xmlns="dummy"
trim="true">
@@ -83,7 +84,7 @@
<!-- Eclipse supports an output directory per input directory -->
<j:set var="testOutputDir" value="${maven.eclipse.test.output.dir}"/>
<j:if test="${empty testOutputDir}">
<maven:pluginVar var="testOutputDir" plugin='maven-test-plugin' property='maven.test.dest'/>
<maven:get var="testOutputDir" plugin='maven-test-plugin' property='maven.test.dest'/>
</j:if>
<maven:makeRelativePath var="testOutputDir" basedir="${basedir}" path="${testOutputDir}" separator="/"/>
@@ -100,7 +101,7 @@
-->
<j:set var="verX" value="${maven.eclipse.junit}X"/>
<maven:pluginVar var="testPlugin" plugin='maven-test-plugin' property='plugin' />
<maven:get var="testPlugin" plugin='maven-test-plugin' property='plugin' />
<j:set var="depVersion">${testPlugin.getDependency('junit').getVersion()}</j:set>
<j:if test="${pom.getDependency('junit') != null}">
@@ -116,18 +117,8 @@
</j:if>
<j:if test="${depVersion != 'none'}">
<eclipse:write-classpath-entry groupId="junit" artifactId="junit" version="${depVersion}" relativePath="" />
<j:set var="ignoreJUnit" value="true" />
<!-- check junit sources -->
<j:set var="mappedsrc" value="junit/${maven.eclipse.src.dir}/junit-${depVersion}.${maven.eclipse.src.extension}"/>
<u:file var="checkSrcExist" name="${maven.repo.local}/${mappedsrc}" />
<j:choose>
<j:when test="${checkSrcExist.exists()}">
<classpathentry kind="var" path="MAVEN_REPO/junit/jars/junit-${depVersion}.jar" sourcepath="MAVEN_REPO/${mappedsrc}"/>
</j:when>
<j:otherwise>
<classpathentry kind="var" path="MAVEN_REPO/junit/jars/junit-${depVersion}.jar"/>
</j:otherwise>
</j:choose>
</j:if>
<j:if test="${pom.build.unitTest != null}">
@@ -143,7 +134,7 @@
</j:if>
</j:if>
<maven:pluginVar var="cactusSrcDir" plugin='cactus-maven' property='cactus.src.dir' />
<maven:get var="cactusSrcDir" plugin='cactus-maven' property='cactus.src.dir' />
<u:available file="${cactusSrcDir}">
<j:set var="cactusSourcePresent" value="true"/>
</u:available>
@@ -154,19 +145,9 @@
<maven:makeRelativePath var="testSrcDir" basedir="${basedir}" path="${cactusSrcDir}" separator="/"/>
<classpathentry kind="src" path="${testSrcDir}"/>
<maven:pluginVar var="cactusPlugin" plugin='cactus-maven' property='plugin' />
<maven:get var="cactusPlugin" plugin='cactus-maven' property='plugin' />
<j:set var="depVersion">${cactusPlugin.getDependency('cactus').getVersion()}</j:set>
<!-- check cactus sources -->
<j:set var="mappedsrc" value="cactus/${maven.eclipse.src.dir}/cactus-${depVersion}.${maven.eclipse.src.extension}"/>
<u:file var="checkSrcExist" name="${maven.repo.local}/${mappedsrc}" />
<j:choose>
<j:when test="${checkSrcExist.exists()}">
<classpathentry kind="var" path="MAVEN_REPO/cactus/jars/cactus-${depVersion}.jar" sourcepath="MAVEN_REPO/${mappedsrc}"/>
</j:when>
<j:otherwise>
<classpathentry kind="var" path="MAVEN_REPO/cactus/jars/cactus-${depVersion}.jar"/>
</j:otherwise>
</j:choose>
<eclipse:write-classpath-entry groupId="cactus" artifactId="cactus" version="${depVersion}" relativePath="" />
<j:set var="ignoreCactus" value="true" />
</j:if>
@@ -198,17 +179,8 @@
<u:file var="checkExist" name="${maven.repo.local}/${relativePath}" />
<j:choose>
<j:when test="${checkExist.exists()}">
<!-- check available sources -->
<j:set var="mappedsrc" value="${lib.dependency.artifactDirectory}/${maven.eclipse.src.dir}/${lib.dependency.artifactId}-${lib.dependency.version}.${maven.eclipse.src.extension}"/>
<u:file var="checkSrcExist" name="${maven.repo.local}/${mappedsrc}" />
<j:choose>
<j:when test="${checkSrcExist.exists()}">
<classpathentry kind="var" path="MAVEN_REPO/${relativePath}" sourcepath="MAVEN_REPO/${mappedsrc}" />
</j:when>
<j:otherwise>
<classpathentry kind="var" path="MAVEN_REPO/${relativePath}"/>
</j:otherwise>
</j:choose>
<eclipse:write-classpath-entry groupId="${lib.dependency.groupId}" artifactId="${lib.dependency.artifactId}"
version="${lib.dependency.version}" relativePath="${relativePath}"/>
</j:when>
<j:otherwise>
<classpathentry kind="lib" path="${lib.path}"/>