0

I am new to Ant.I have created one ant task for generating pmd on the basis of ruleset.xml.Below code is not working, when i do ant pmd..i want to know whether any problem with this code..

  • whether toFile should be entire path(D:\Jenkins) or one the basis of root directory itself?
  • Can i run pmd task without depending any other task? Will it be a problem?
  • Problem showing with ruleset tag like it should be followed by > or /> or attribute element? :

    <path id="pmd.classpath">
    <fileset dir="/lib/runtime">
     <include name="**/*.jar"/>
     </fileset>
        </path>
    
    <target name="pmd" depends="init">
    <taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask" classpathref="pmd.classpath"/>
    <pmd shortFilenames="true">
    <ruleset="/build/ruleset.xml"/>
    <formatter type="xml" toFile="/build/pmd.xml"/>
    <fileset dir="/src">
    <include name="**/*.java"/>
    </fileset>
    </pmd>
    </target>
    

Please somebody help me regarding this?..I just started only..

Thanks in Advance

varghese
  • 131
  • 1
  • 4
  • 12
  • What output or error is shown when you execute your pmd target? – ewan.chalmers Jul 11 '12 at 13:25
  • Now the i am getting new error like. Problem: failed to create task or type pmd Cause: The name is undefined. Action: Check the spelling. Action: Check that any custom tasks/types have been declared. Action: Check that any / declarations have taken place. – varghese Jul 11 '12 at 14:44
  • Are the PMD jars really to be found at `/lib/runtime` (an absolute path on a unix box)? – ewan.chalmers Jul 11 '12 at 16:28

1 Answers1

0

All your paths are absolute: /lib, /build, /src. I suspect that in fact, all these paths should be relative to your project: lib, build, src.

Make sure that the PMD jar are really at the absolute or relative path you use in the path fileset.

ewan.chalmers
  • 16,145
  • 43
  • 60