Index: src/dvsl/xdocs/checkstyle.dvsl
===================================================================
RCS file: /home/cvspublic/jakarta-turbine-maven/src/dvsl/xdocs/checkstyle.dvsl,v
retrieving revision 1.1
diff -u -r1.1 checkstyle.dvsl
--- src/dvsl/xdocs/checkstyle.dvsl	8 Apr 2002 00:09:02 -0000	1.1
+++ src/dvsl/xdocs/checkstyle.dvsl	26 May 2002 10:29:36 -0000
@@ -17,14 +17,14 @@
 #######################################################################
 
 ## Convert a string that represents a number using the specified
-## pattern.  
+## pattern.
 ##
 #macro (formatAsNumber $string $pattern)
     #set ($value = $context.toolbox.numbers.parse($string))
     $context.toolbox.formatter.formatNumber($value, $pattern)
 #end
 
-## Create link to the xref docs for a particular file and line 
+## Create link to the xref docs for a particular file and line
 ## number.
 ##
 #macro (createLineNumberLink $name $line)
@@ -38,17 +38,14 @@
 #end
 
 #######################################################################
-## T E M P L A T E    D E F I N I T I O N S                          ## 
-####################################################################### 
+## T E M P L A T E    D E F I N I T I O N S                          ##
+#######################################################################
 
 ## Matches the root element of the JUnit XML report.
 ##
 #match ("checkstyle")
 <?xml version="1.0"?>
 
-#set ($basedir = $context.toolbox.fileutil.file($context.toolbox.srcDir).getAbsolutePath())
-#set ($basedirlen = $basedir.length() + 1)
-
 <document>
 
   <properties>
@@ -59,7 +56,7 @@
     <section name="Checkstyle Results">
       <p>
         The following document contains the results of <a
-        href="http://checkstyle.sourceforge.net/">Checkstyle</a>.  
+        href="http://checkstyle.sourceforge.net/">Checkstyle</a>.
       </p>
     </section>
 
@@ -78,7 +75,7 @@
       <table>
         <tr><th>Files</th><th>Errors</th></tr>
         #foreach ($file in $node.selectNodes("file"))
-          #set ($name = $file.attribute("name").substring($basedirlen))
+          #set ($name = $context.toolbox.pathtool.getPackagePath($file.attribute('name')))
           #set ($errorCount = $file.valueOf("count(error)"))
         <tr>
           <td><a href="#$name">$name</a></td>
@@ -86,10 +83,11 @@
         </tr>
         #end
       </table>
-  
+
       #foreach ($file in $node.selectNodes("file"))
         #if ($file.get("error"))
-          #set ($name = $file.attribute('name').substring($basedirlen))
+          #set ($name = $context.toolbox.pathtool.getPackagePath($file.attribute('name')))
+
       <subsection name="$name">
         <table>
           <tr><th>Error</th><th>Line</th></tr>
Index: src/java/org/apache/maven/DVSLPathTool.java
===================================================================
RCS file: /home/cvspublic/jakarta-turbine-maven/src/java/org/apache/maven/DVSLPathTool.java,v
retrieving revision 1.5
diff -u -r1.5 DVSLPathTool.java
--- src/java/org/apache/maven/DVSLPathTool.java	6 May 2002 02:03:31 -0000	1.5
+++ src/java/org/apache/maven/DVSLPathTool.java	26 May 2002 10:29:36 -0000
@@ -54,7 +54,12 @@
  * <http://www.apache.org/>.
  */
 
+import java.io.IOException;
+import java.io.File;
+
 import org.apache.commons.lang.Strings;
+import jdepend.framework.JavaSourceFileParser;
+import jdepend.framework.JavaClass;
 
 /** 
  * Path tool for use with the DVSL toolbox.  This class contains static
@@ -62,6 +67,7 @@
  * relative paths.
  * 
  * @author <a href="mailto:pete-apache-dev@kazmier.com">Pete Kazmier</a>
+ * @author <a href="vmassol@apache.org">Vincent Massol</a>
  * @version $Id: DVSLPathTool.java,v 1.5 2002/05/06 02:03:31 kaz Exp $
  */
 public class DVSLPathTool
@@ -256,4 +262,41 @@
 
         return forwardCount >= backwardCount ? "/" : "\\";
     }
+
+    /**
+     * Extracts the package name from the java source file and returns it as
+     * a directory. For example if the file name is :
+     * "e:\tmp\src\main\org\apache\maven\Code.java", and <code>Code.java</code>
+     * is in the <code>org.apache.maven</code> package, this method will
+     * return "org\apache\maven\Code.java" (or "org/apache/maven/Code.java" on
+     * unix).
+     *
+     * @param absoluteFileName the absolute file name to transform
+     * @return the shortened file name matching the class package name.
+     * @throws java.io.IOException upon failure to read the java file
+     */
+    public static final String getPackagePath(String absoluteFileName)
+        throws IOException
+    {
+        String shortenedPath;
+
+        JavaSourceFileParser parser = new JavaSourceFileParser();
+        JavaClass clazz = parser.parse(absoluteFileName);
+
+        String packageName = clazz.getPackageName();
+
+        // Handle default packages for which JDepend returns "default"
+        if (packageName.equals("default"))
+        {
+            shortenedPath = clazz.getName() + ".java";
+        }
+        else
+        {
+            shortenedPath = packageName.replace('.', File.separatorChar) +
+                File.separatorChar + clazz.getName() + ".java";
+        }
+
+        return shortenedPath;
+    }
+
 }
Index: src/templates/build/plugins/core/build.xml
===================================================================
RCS file: /home/cvspublic/jakarta-turbine-maven/src/templates/build/plugins/core/build.xml,v
retrieving revision 1.2
diff -u -r1.2 build.xml
--- src/templates/build/plugins/core/build.xml	24 May 2002 15:41:28 -0000	1.2
+++ src/templates/build/plugins/core/build.xml	26 May 2002 10:29:36 -0000
@@ -25,7 +25,7 @@
   <!-- E N V I R O N M E N T                                              -->
   <!-- ================================================================== -->
 
-  <target 
+  <target
     name="env"
     depends="local-init,#callback("pre-env"),do-env,#callback("post-env")"/>
 
@@ -37,10 +37,10 @@
       java.home = ${java.home}
       user.home = ${user.home}
       lib.repo = ${lib.repo}
-      
+
       Classpath:
       ${maven.dependency.classpath}
-    </echo>      
+    </echo>
   </target>
 
   <!-- ================================================================== -->
@@ -104,17 +104,17 @@
     -->
     <property file="${maven.home}/plugins/core/default.properties" />
 
-    <taskdef 
+    <taskdef
       name="maven-update-check"
       className="org.apache.maven.UpdateMavenCheck">
       <classpath refid="maven-classpath"/>
     </taskdef>
 
     <maven-update-check/>
-    
+
     <echo>
       maven.mavenUpdateRequired = ${maven.mavenUpdateRequired}
-    </echo>      
+    </echo>
 
   </target>
 
@@ -125,22 +125,22 @@
   <target
     name="do-maven-update"
     if="maven.mavenUpdateRequired">
-        
+
     <!-- We need to update the Maven installation so we need to
-    
+
          1. Pull down the new distribution JAR (hopefully we can
             make this more efficient than having to replace the
             whole JAR but it will do for now).
-            
+
          2. Move the old directory out of the way.
-         
+
          3. Unpack the new distribution.
     -->
-    
+
     <property name="mavenUpdateZip" value="maven-${maven.mavenVersion}.zip"/>
 
     <!-- Grab the update zip file -->
-    <get 
+    <get
       src="${maven.updateSite}/${mavenUpdateZip}"
       dest="${lib.repo}/${mavenUpdateZip}"
       verbose="true"
@@ -157,7 +157,7 @@
 
     <!-- Make a the new one -->
     <mkdir dir="${maven.home}"/>
-    
+
     <!-- Unpack the new installation -->
     <unzip
       src="${lib.repo}/${mavenUpdateZip}"
@@ -178,50 +178,50 @@
 
   <target
     name="do-validate-pom">
-    
-    <taskdef 
+
+    <taskdef
       name="validate-pom" classname="org.apache.maven.XmlPomValidator">
       <classpath>
         <path refid="maven-classpath"/>
       </classpath>
     </taskdef>
-    
+
     <validate-pom
       projectDescriptor="project.xml"
       xmlSchema="${maven.home}/project.xsd"
     />
-    
+
   </target>
-    
+
 
   <!-- ================================================================== -->
   <!-- U S A G E                                                          -->
   <!-- ================================================================== -->
 
-  <target 
+  <target
     name="usage">
-    
+
     <echo message="use -projecthelp to see the available targets"/>
   </target>
 
   <!-- ================================================================== -->
   <!-- P R E P A R E  S O U R C E S                                       -->
   <!-- ================================================================== -->
-  
+
   <target
     name="prepare-sources"
     if="maven.prepareSourceDirectory">
-    
+
     <echo>
       maven.prepareSourceDirectory = ${maven.prepareSourceDirectory}
     </echo>
-    
+
     <mkdir dir="${maven.prepareSourceDirectory}"/>
-    
+
     <!-- We need to do this here but we need to make a
          fileset reference to make this easier.
     -->
-    
+
     <!--
     <copy todir="${build.dir}">
       <fileset dir=".">
@@ -229,8 +229,8 @@
       </fileset>
     </copy>
     -->
-    
-    <ant 
+
+    <ant
       antfile="${maven.delegatorBuildFile}"
       target="${maven.prepareSourceTarget}"
     />
@@ -297,13 +297,13 @@
       name="ajc"
       classname="org.aspectj.tools.ant.taskdefs.Ajc"/>
 
-    <ajc 
+    <ajc
       destdir="${maven.build.dest}"
       excludes="**/package.html"
       debug="${maven.compile.debug}"
       deprecation="${maven.compile.deprecation}"
       optimize="${maven.compile.optimize}">
-      
+
       <src>
         <path refid="maven.compile.src.set"/>
         <path refid="maven.src.aspect.set"/>
@@ -320,7 +320,7 @@
            does include Ant's runtime libraries when compiling, so to
            mimic this behavior, we need to manually include the jars
            from the ant.home/lib directory.
-         --> 
+         -->
         <fileset dir="${ant.home}/lib">
           <include name="**/*.jar"/>
         </fileset>
@@ -328,7 +328,7 @@
     </ajc>
 
   </target>
-  
+
   <!-- ================================================================== -->
   <!-- C H E C K S O U R C E                                              -->
   <!-- ================================================================== -->
@@ -336,10 +336,10 @@
     name="check-source"
     depends="local-init, env, #callback("pre-check-source"), do-check-source, #callback("post-check-source")"
     description="o Check the source code for style violations"/>
-    
+
   <target name="do-check-source" if="maven.sourcesPresent">
 
-    <taskdef 
+    <taskdef
       name="checkstyle"
       classname="com.puppycrawl.tools.checkstyle.CheckStyleTask">
       <classpath refid="maven-classpath"/>
@@ -389,12 +389,12 @@
       ignorePublicInInterface="${maven.checkstyle.ignore.public.in.interface}"
       failOnViolation="${maven.checkstyle.fail.on.violation}"
       cacheFile="${maven.checkstyle.cache.file}" >
-      <fileset 
-        dir="${maven.src.dir}" 
+      <fileset
+        dir="${maven.src.dir}"
         includes="${maven.checkstyle.includes}"
         excludes="${maven.checkstyle.excludes}"/>
-      <formatter type="xml" toFile="${maven.build.dir}/checkstyle-raw-report.xml"/> 
-      <formatter type="plain" toFile="${maven.build.dir}/checkstyle-raw-report.txt"/> 
+      <formatter type="xml" toFile="${maven.build.dir}/checkstyle-raw-report.xml"/>
+      <formatter type="plain" toFile="${maven.build.dir}/checkstyle-raw-report.txt"/>
     </checkstyle>
 
     <dvsl
@@ -407,15 +407,14 @@
       <classpath>
         <path refid="maven-classpath"/>
       </classpath>
-      <tool name="toolbox.string.srcDir" value="${maven.src.dir}"/>
     </dvsl>
 
   </target>
-    
+
   <!-- ================================================================== -->
   <!-- J A R  R E S O U R C E S                                           -->
   <!-- ================================================================== -->
-  
+
   <target
     name="jar-resources"
     depends="local-init,env"
@@ -424,18 +423,18 @@
     <!-- Copy any resources that must be present in the deployed
          JAR file.
     -->
-    
+
     <echo>
       Copy resources into destination directory for deployment
       in the JAR.
     </echo>
-    
+
     <copy todir="${maven.build.dest}">
       <fileset dir="${maven.jarResources.basedir}">
         <patternset refid="maven.jar.resources.set"/>
       </fileset>
     </copy>
-  </target>    
+  </target>
 
   <!-- ================================================================== -->
   <!-- J A R                                                              -->
@@ -449,7 +448,7 @@
   <target name="do-jar" depends="jar-resources">
 
     <ant antfile="${maven.home}/plugins/test/build.xml" target="test"/>
-    
+
     <jar
       jarfile="${maven.build.dir}/${maven.final.name}.jar"
       basedir="${maven.build.dest}"
@@ -488,35 +487,35 @@
   <!--                                                                    -->
   <!-- You would use a command like the following to build a distribution -->
   <!-- for your project:                                                  -->
-  <!--                                                                    -->   
-  <!-- ant maven:dist -Dmaven.tag=MAVEN_B4                                -->      
+  <!--                                                                    -->
+  <!-- ant maven:dist -Dmaven.tag=MAVEN_B4                                -->
   <!-- ================================================================== -->
 
   <target name="dist" depends="dist-check-tag,#callback("pre-dist"),do-dist,#callback("post-dist")"/>
 
   <target name="do-dist" if="maven.tag">
-    
+
     <antcall target="dist-checkout-sources"/>
-    
+
   </target>
 
   <target
     name="dist-checkout-sources"
     depends="local-init">
-    
-    <!-- 
-    
+
+    <!--
+
     Make sure the dist directory is remove so that we know
     we are starting with a clean slate. We will also place a
     file in ${maven.distBuildDirectory} which indicates that
     it is ok to build a distribution within that directory.
-    
+
     -->
-    
+
     <delete dir="${maven.distBuildDirectory}"/>
     <mkdir dir="${maven.distBuildDirectory}/${maven.cvsModule}"/>
     <touch file="${maven.distBuildDirectory}/${maven.cvsModule}/${maven.distBuildIndicator}"/>
-    
+
     <cvs
       cvsRoot="${maven.cvsRoot}"
       package="${maven.cvsModule}"
@@ -525,29 +524,29 @@
     />
 
     <!--
-    
+
     Now that we have our freshly checked out sources we can use
     those sources to create our distribution.
-    
+
     -->
-    
-    <ant 
+
+    <ant
       dir="${maven.distBuildDirectory}/${maven.cvsModule}"
       target="maven:dist-build"
       inheritAll="false"
     />
-    
+
     <!--
-    
+
     The distributions have been created with fresh sources so
     lets move the distributions into a visible location and
     remove everything used to create the distributions so that
     no mistakes can be made unintentionally.
-    
+
     -->
-    
+
     <mkdir dir="${maven.distDirectory}"/>
-    
+
     <copy todir="${maven.distDirectory}">
       <fileset dir="${maven.distBuildDirectory}/${maven.cvsModule}/target">
         <include name="**/*.tar.gz"/>
@@ -612,11 +611,11 @@
       </tarfileset>
     </tar>
 
-    <gzip 
-      zipfile="${maven.build.dir}/${maven.final.name}.tar.gz" 
+    <gzip
+      zipfile="${maven.build.dir}/${maven.final.name}.tar.gz"
       src="${maven.build.dir}/${maven.final.name}.tar"
     />
-    
+
     <delete file="${maven.build.dir}/${maven.final.name}.tar"/>
 
     <!-- Create a zip file -->
@@ -658,11 +657,11 @@
       </tarfileset>
     </tar>
 
-    <gzip 
-      zipfile="${maven.build.dir}/${maven.final.name}-src.tar.gz" 
+    <gzip
+      zipfile="${maven.build.dir}/${maven.final.name}-src.tar.gz"
       src="${maven.build.dir}/${maven.final.name}-src.tar"
     />
-    
+
     <delete file="${maven.build.dir}/${maven.final.name}-src.tar"/>
 
     <!-- Create a zip file -->
@@ -687,8 +686,8 @@
   <!-- I N S T A L L  J A R                                               -->
   <!-- ================================================================== -->
 
-  <target 
-    name="install-jar" 
+  <target
+    name="install-jar"
     depends="jar,#callback("pre-install-jar"),do-install-jar,#callback("post-install-jar")"
     description="o Installs JAR file in local ${lib.repo}"/>
 
@@ -715,7 +714,7 @@
 
   <target name="do-gump-descriptor">
 
-    <taskdef 
+    <taskdef
       name="dvsl" classname="org.apache.tools.dvsl.DVSLTask">
       <classpath>
         <path refid="maven-classpath"/>
@@ -730,13 +729,13 @@
       in="project.xml"
       out="gump.xml"
     />
-  
+
     <taskdef
       name="gump-build"
       classname="org.apache.maven.BaseProjectTask">
       <classpath refid="maven-classpath"/>
     </taskdef>
-                              
+
     <gump-build
       controlTemplate="build-gump.xml"
       outputDirectory="${basedir}"
@@ -744,14 +743,14 @@
       outputFile="build-gump.xml"
       projectDescriptor="project.xml"
     />
-  
+
   </target>
 
   <!-- ================================================================== -->
   <!-- C L E A N                                                          -->
   <!-- ================================================================== -->
 
-  <target 
+  <target
     name="clean"
     depends="local-init,#callback("pre-clean"),do-clean,#callback("post-clean")"
     description="o Cleans up the build directory"/>
@@ -801,30 +800,30 @@
 
   <target
     name="do-announce">
-    
+
     <!-- Need to make sure all these values are set before trying
          to send an announcement so that we're not spamming
          people needlessly.
     -->
-    
+
     <property file="${maven.src.dir}/announcements/${maven.announcement}.properties"/>
-    
+
     <echo>
-      from="${maven.announcementFrom}" 
-      tolist="${maven.announcementRecipients}" 
+      from="${maven.announcementFrom}"
+      tolist="${maven.announcementRecipients}"
       subject="${maven.announcementSubject}"
       files="${maven.announcementFile}"
       mailHost="${maven.mailHost}"
-    </echo>    
-    
-    <mail 
-      from="${maven.announcementFrom}" 
-      tolist="${maven.announcementRecipients}" 
+    </echo>
+
+    <mail
+      from="${maven.announcementFrom}"
+      tolist="${maven.announcementRecipients}"
       subject="${maven.announcementSubject}"
       files="${maven.announcementFile}"
       mailHost="${maven.mailHost}"
     />
-  
+
   </target>
 
 </project>

