You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by ep...@apache.org on 2004/10/15 20:08:29 UTC

cvs commit: maven-plugins/eclipse/src/plugin-resources/templates classpath.jelly

epugh       2004/10/15 11:08:29

  Modified:    eclipse  plugin.jelly
               eclipse/src/plugin-resources/templates classpath.jelly
  Log:
  Reuse Jelly script via tag.  Other stylistic fixes.
  
  Revision  Changes    Path
  1.29      +27 -5     maven-plugins/eclipse/plugin.jelly
  
  Index: plugin.jelly
  ===================================================================
  RCS file: /home/cvs/maven-plugins/eclipse/plugin.jelly,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- plugin.jelly	9 Aug 2004 15:01:39 -0000	1.28
  +++ plugin.jelly	15 Oct 2004 18:08:28 -0000	1.29
  @@ -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                   -->
  
  
  
  1.26      +9 -37     maven-plugins/eclipse/src/plugin-resources/templates/classpath.jelly
  
  Index: classpath.jelly
  ===================================================================
  RCS file: /home/cvs/maven-plugins/eclipse/src/plugin-resources/templates/classpath.jelly,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- classpath.jelly	15 Oct 2004 13:48:11 -0000	1.25
  +++ classpath.jelly	15 Oct 2004 18:08:29 -0000	1.26
  @@ -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}"/>
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org