You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ah...@apache.org on 2006/02/03 23:18:33 UTC

svn commit: r374762 - /maven/maven-1/plugins/trunk/pmd/src/plugin-resources/pmd.jsl

Author: aheritier
Date: Fri Feb  3 14:18:29 2006
New Revision: 374762

URL: http://svn.apache.org/viewcvs?rev=374762&view=rev
Log:
Change the test to see if the jxr plugin is used. The previous one worked only if the jxr plugin wass called before the pmd report.

Modified:
    maven/maven-1/plugins/trunk/pmd/src/plugin-resources/pmd.jsl

Modified: maven/maven-1/plugins/trunk/pmd/src/plugin-resources/pmd.jsl
URL: http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/pmd/src/plugin-resources/pmd.jsl?rev=374762&r1=374761&r2=374762&view=diff
==============================================================================
--- maven/maven-1/plugins/trunk/pmd/src/plugin-resources/pmd.jsl (original)
+++ maven/maven-1/plugins/trunk/pmd/src/plugin-resources/pmd.jsl Fri Feb  3 14:18:29 2006
@@ -33,7 +33,7 @@
   <j:useBean var="htmlescape" class="org.apache.velocity.anakia.Escape"/>
   <j:useBean var="fileutil" class="org.apache.velocity.texen.util.FileUtil"/>
   <j:useBean var="pathtool" class="org.apache.maven.util.DVSLPathTool"/>
-  <!-- Make sure the jxr plugin is loaded -->
+  <!-- Force the jxr plugin to be loaded - even if it's not used in the project -->
   <maven:set plugin="maven-jxr-plugin" property="foo" value="bar"/>
   <jsl:template match="pmd">
     <document>
@@ -116,14 +116,20 @@
           <!-- Where documentations are generated -->
           <j:set var="docsDestDir" value="${maven.docs.dest}"/>
           <util:replace var="docsDestDir" value="${docsDestDir}" oldChar="\\" newChar="/"/>
+          <!-- JXR is activated ? -->
+          <j:set var="jxrActivated" value="false"/>
+          <j:forEach var="report" items="${pom.reports}">
+            <j:if test="${report.equals('maven-jxr-plugin')}">
+              <j:set var="jxrActivated" value="true"/>
+            </j:if>
+          </j:forEach>
           <!-- I don't think this test is useful but .... in the case of.. -->
           <j:if test="${pom.build.sourceDirectory != null}">
             <!-- Where JXR files are generated for the code -->
             <j:set var="jxrDestDir" value="${maven.jxr.destdir}"/>
             <util:replace var="jxrDestDir" value="${jxrDestDir}" oldChar="\\" newChar="/"/>
-            <util:file var="jxrDestDirFile" name="${jxrDestDir}"/>
             <j:choose>
-              <j:when test="${jxrDestDirFile.exists() and jxrDestDir.startsWith(docsDestDir)}">
+              <j:when test="${jxrActivated and jxrDestDir.startsWith(docsDestDir)}">
 	            <!-- We create a relative path to the jxr files -->
 	            <!-- ${maven.jxr.destdir} should be a subdirectory of ${maven.docs.dest} -->
 				<j:set var="jxrDestDir" value="${jxrDestDir.substring(docsDestDir.length(),jxrDestDir.length())}"/>
@@ -142,9 +148,9 @@
             <!-- Where JXR files are generated for the tests -->
             <j:set var="jxrTestDestDir" value="${maven.jxr.destdir.test}"/>
             <util:replace var="jxrTestDestDir" value="${jxrTestDestDir}" oldChar="\\" newChar="/"/>
-            <util:file var="jxrTestDestDirFile" name="${jxrTestDestDir}"/>
+            <maven:get var="xrefGeneratedForTests" plugin="maven-jxr-plugin" property="maven.jxr.include.testXref"/>
             <j:choose>
-              <j:when test="${jxrTestDestDirFile.exists()} and jxrTestDestDir.startsWith(docsDestDir)">
+              <j:when test="${jxrActivated and xrefGeneratedForTests and jxrTestDestDir.startsWith(docsDestDir)}">
 	            <!-- We create a relative path to the jxr files for tests -->
 	            <!-- ${maven.jxr.destdir.test} should be a subdirectory of ${maven.docs.dest} -->
 				<j:set var="jxrTestDestDir" value="${jxrTestDestDir.substring(docsDestDir.length(),jxrTestDestDir.length())}"/>