Skip to main content
December 13, 2009
Answered

i feel stupid :)

  • December 13, 2009
  • 3 replies
  • 4301 views

Hi all,

i'm trying to integrate pmd in our build with ant but get the following rror:

[flexPmd] net.sourceforge.pmd.RuleSetNotFoundException: Can't find resource com/adobe/ac/pmd/rulesets/architecture.xml. Make sure the resource is a valid file or URL or is on the CLASSPATH

  [flexPmd] at net.sourceforge.pmd.util.ResourceLoader.loadResourceAsStream(ResourceLoader.java:28)

  [flexPmd] at net.sourceforge.pmd.RuleSetFactory.parseRuleSetReferenceNode(RuleSetFactory.java:284)

  [flexPmd] at net.sourceforge.pmd.RuleSetFactory.parseRuleNode(RuleSetFactory.java:251)

  [flexPmd] at net.sourceforge.pmd.RuleSetFactory.parseRuleSetNode(RuleSetFactory.java:209)

  [flexPmd] at net.sourceforge.pmd.RuleSetFactory.createRuleSet(RuleSetFactory.java:157)

  [flexPmd] at net.sourceforge.pmd.RuleSetFactory.createRuleSet(RuleSetFactory.java:146)

  [flexPmd] at com.adobe.ac.pmd.engines.AbstractFlexPmdEngine.loadRuleset(AbstractFlexPmdEngine.java:184)

  [flexPmd] at com.adobe.ac.pmd.engines.AbstractFlexPmdEngine.<init>(AbstractFlexPmdEngine.java:100)

I set it up like on the doc page and if i echo the task with filled in paths i get the right ones:
Buildfile: build.xml
     [echo]
     [echo]
     [echo] <taskdef name="flexPmd"
     [echo] classname="com.adobe.ac.pmd.ant.FlexPmdAntTask"
     [echo] classpath="/Users/arnoudbos/Desktop/AgileFlex2/_build/taskdef-lib/flexpmd/1.0/flex-pmd-ant-task-1.0.jar">
     [echo] <classpath>
     [echo] <pathelement location="/Users/arnoudbos/Desktop/AgileFlex2/_build/taskdef-lib/flexpmd/1.0/as3-parser-1.0.jar"/>
     [echo] <pathelement location="/Users/arnoudbos/Desktop/AgileFlex2/_build/taskdef-lib/flexpmd/1.0/as3-parser-api-1.0.jar"/>
     [echo] <pathelement location="/Users/arnoudbos/Desktop/AgileFlex2/_build/taskdef-lib/flexpmd/1.0/as3-plugin-utils-1.0.jar"/>
     [echo] <pathelement location="/Users/arnoudbos/Desktop/AgileFlex2/_build/taskdef-lib/flexpmd/1.0/commons-lang-2.4.jar"/>
     [echo] <pathelement location="/Users/arnoudbos/Desktop/AgileFlex2/_build/taskdef-lib/flexpmd/1.0/flex-pmd-core-1.0.jar"/>
     [echo] <pathelement location="/Users/arnoudbos/Desktop/AgileFlex2/_build/taskdef-lib/flexpmd/1.0/flex-pmd-files-1.0.jar"/>
     [echo] <pathelement location="/Users/arnoudbos/Desktop/AgileFlex2/_build/taskdef-lib/flexpmd/1.0/flex-pmd-ruleset-1.0.jar"/>
     [echo] <pathelement location="/Users/arnoudbos/Desktop/AgileFlex2/_build/taskdef-lib/flexpmd/1.0/flex-pmd-ruleset-api-1.0.jar"/>
     [echo] <pathelement location="/Users/arnoudbos/Desktop/AgileFlex2/_build/taskdef-lib/flexpmd/1.0/plexus-utils-1.0.2.jar"/>
     [echo] <pathelement location="/Users/arnoudbos/Desktop/AgileFlex2/_build/taskdef-lib/flexpmd/1.0/pmd-4.2.5.jar"/>
     [echo] </classpath>
     [echo] </taskdef>
     [echo]
     [echo]
i call the task without a ruleset so it should use the default one, right?

<flexPmd sourceDirectory="${src.flex.dir}" outputDirectory="${build.pmd.dir}" />

any thoughts? No one but me seems to have trouble to get the thing to work ....

i use the latest version 1.0 from the adobe opensource site

any help would be highly appreciated!

Arnoud

This topic has been closed for replies.
Correct answer clotton

We resolved the issue.

It seems the Ant 1.7 supplied to us contained an old pmd-4.1.jar in the lib directory.   Removing that jar solves the problem.  This jar wasn't present in the supplied Ant 1.8, which is why that version worked.

3 replies

clottonCorrect answer
Inspiring
October 19, 2010

We resolved the issue.

It seems the Ant 1.7 supplied to us contained an old pmd-4.1.jar in the lib directory.   Removing that jar solves the problem.  This jar wasn't present in the supplied Ant 1.8, which is why that version worked.

November 25, 2010

I can confirm this. Problem is gone in a clean ant 1.8.1 installation

cheers,

Arnoud

Inspiring
October 6, 2010

I just got it to work by switching to Ant 1.8.

Adobe Employee
December 14, 2009

Ok. Your error means that your flex-pmd-ruleset-1.0-jar is not foud.

You need to make sure that this file is in the class-path.

Xavier

December 14, 2009

Hi thanx for the fast reply.

Does that mean that including the jars in the taskdef of flexPmdAntTask is not sufficient? Now i have:

<taskdef name="flexPmd"
    classname="com.adobe.ac.pmd.ant.FlexPmdAntTask"
    classpath="/Users/arnoudbos/Desktop/AgileFlex2/_build/taskdef-lib/flexpmd/1.0/flex-pmd-ant-task-1.0.jar">
    <classpath>
         <pathelement location="/Users/arnoudbos/Desktop/AgileFlex2/_build/taskdef-lib/flexpmd/1.0/as3-parser-1.0.jar"/>
         <pathelement location="/Users/arnoudbos/Desktop/AgileFlex2/_build/taskdef-lib/flexpmd/1.0/as3-parser-api-1.0.jar"/>
         <pathelement location="/Users/arnoudbos/Desktop/AgileFlex2/_build/taskdef-lib/flexpmd/1.0/as3-plugin-utils-1.0.jar"/>
         <pathelement location="/Users/arnoudbos/Desktop/AgileFlex2/_build/taskdef-lib/flexpmd/1.0/commons-lang-2.4.jar"/>
         <pathelement location="/Users/arnoudbos/Desktop/AgileFlex2/_build/taskdef-lib/flexpmd/1.0/flex-pmd-core-1.0.jar"/>
         <pathelement location="/Users/arnoudbos/Desktop/AgileFlex2/_build/taskdef-lib/flexpmd/1.0/flex-pmd-files-1.0.jar"/>
         <pathelement location="/Users/arnoudbos/Desktop/AgileFlex2/_build/taskdef-lib/flexpmd/1.0/flex-pmd-ruleset-1.0.jar"/>
etc...
i verified the paths, if i have to include the .jars in the classpath in another way i wonder why they should be included like above?
any further insights?
Thanx
Arnoud

Inspiring
October 6, 2010

Did you ever get this to work?

I'm having the EXACT same problem, and I've verified that my paths are correct, file names are correct, etc.  I just can't figure out why it's not picking up the ruleset jar, when it's clearly there.

Any ideas?