ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Karr, David" <>
Subject How to accumulate a list of files for pmd instead of running pmd on each one
Date Wed, 07 Nov 2007 18:15:05 GMT
JDK 1.4.2, Ant 1.5.4, xmltask 1.11, PMD 4.0 (JDK 1.4 version).

I have a process where I use xmltask to parse one or more Spring context
files, looking for bean classes with certain characteristics.  For each
bean class that I find, I call another target that runs PMD on that
class.  I'd really prefer to accumulate a list of files, and then call
PMD on the entire list.

So, for instance, following this is an excerpt from my build script that
goes through these steps.  Can you think of a practical way I could
rearrange this so I first build a list of classes to process, and then
run PMD in one step?

 <target name="spring.processFile">
  <xmltask source="${spring.fileToProcess}">
    <dtd publicId="-//SPRING//DTD BEAN//EN" 
   <call path="/beans/bean[@singleton!='false']" target="processClass"
    <param name="className" path="@class"/>

 <target name="processClass">
  <propertyregex property="filePath" input="${className}" regexp="\."
                 replace="/" global="true"/>
  <antcall target="runpmd">
   <param name="file" value="${filePath}.java"/>
   <param name="srcroot" value="src/java"/>

 <path id="pmd.classpath">
  <pathelement location="${basedir}/build/classes"/>
  <pathelement location="${pmd.jar}"/>
  <pathelement location="${util-concurrent.jar}"/>
  <pathelement location="${retroweaver-rt.jar}"/>
  <pathelement location="${jaxen.jar}"/>

 <taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask"
          classpathref="pmd.classpath" />

 <property name="more.rulesets" value=""/>

 <target name="runpmd">
   <formatter type="text" toConsole="true"/>
   <fileset dir="${srcroot}">
    <include name="${file}"/>

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message