Skip navigation
Arnoud Bos
Currently Being Moderated

i feel stupid :)

Dec 13, 2009 2:12 PM

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(Resource Loader.java:28)

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

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

  [flexPmd] at net.sourceforge.pmd.RuleSetFactory.parseRuleSetNode(RuleSetFactory.ja va: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(AbstractFl exPmdEngine.java:184)

  [flexPmd] at com.adobe.ac.pmd.engines.AbstractFlexPmdEngine.<init>(AbstractFlexPmd Engine.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/flex pmd/1.0/flex-pmd-ant-task-1.0.jar">
     [echo] <classpath>
     [echo] <pathelement location="/Users/arnoudbos/Desktop/AgileFlex2/_build/taskdef-lib/flex pmd/1.0/as3-parser-1.0.jar"/>
     [echo] <pathelement location="/Users/arnoudbos/Desktop/AgileFlex2/_build/taskdef-lib/flex pmd/1.0/as3-parser-api-1.0.jar"/>
     [echo] <pathelement location="/Users/arnoudbos/Desktop/AgileFlex2/_build/taskdef-lib/flex pmd/1.0/as3-plugin-utils-1.0.jar"/>
     [echo] <pathelement location="/Users/arnoudbos/Desktop/AgileFlex2/_build/taskdef-lib/flex pmd/1.0/commons-lang-2.4.jar"/>
     [echo] <pathelement location="/Users/arnoudbos/Desktop/AgileFlex2/_build/taskdef-lib/flex pmd/1.0/flex-pmd-core-1.0.jar"/>
     [echo] <pathelement location="/Users/arnoudbos/Desktop/AgileFlex2/_build/taskdef-lib/flex pmd/1.0/flex-pmd-files-1.0.jar"/>
     [echo] <pathelement location="/Users/arnoudbos/Desktop/AgileFlex2/_build/taskdef-lib/flex pmd/1.0/flex-pmd-ruleset-1.0.jar"/>
     [echo] <pathelement location="/Users/arnoudbos/Desktop/AgileFlex2/_build/taskdef-lib/flex pmd/1.0/flex-pmd-ruleset-api-1.0.jar"/>
     [echo] <pathelement location="/Users/arnoudbos/Desktop/AgileFlex2/_build/taskdef-lib/flex pmd/1.0/plexus-utils-1.0.2.jar"/>
     [echo] <pathelement location="/Users/arnoudbos/Desktop/AgileFlex2/_build/taskdef-lib/flex pmd/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

 

 

 

 

 
Replies
  • Currently Being Moderated
    Dec 13, 2009 10:50 PM   in reply to Arnoud Bos

    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

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 6, 2010 7:28 AM   in reply to Arnoud Bos

    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?

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 6, 2010 7:29 AM   in reply to clotton

    Hi,

     

    could you try using this newer build http://www.rialvalue.com/flexPmd/updateSite/

     

    We´ll release this version early next week. this problems should be fixed there

     

    Xavi    

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 6, 2010 8:15 AM   in reply to xavi.beumala

    Thank you for the link, but I'm afraid it doesn't contain a build.  Only a jar with one xml file in it. 

     

    Do older versions of flex pmd work?

     

    Thanks

     

    Chris

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 6, 2010 8:18 AM   in reply to clotton

    Hi,

     

    it's not a build, it's an update site for the eclipse plugin. I think I've missed read your thread though thinking you had a problem with the eclipse plugin and the project paths

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 6, 2010 8:19 AM   in reply to xavi.beumala

    No, the issue is with the ant task, not the eclipse plugin.

     

    Thanks

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 6, 2010 8:22 AM   in reply to clotton

    Did you add the ruleset jar to the ant task classpath?

     

    That's all you should need to do.

     

    Xavier

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 6, 2010 8:27 AM   in reply to Xavier Agnetti

    Yes, and confirmed its path and spelling is valid.  Like Arnoud, I've used the example ant task provided.

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 6, 2010 8:46 AM   in reply to Arnoud Bos

    FYI, I've tried version 1.2, 1.1, and 1.0 with the same result:

     

    Re: i feel stupid :) 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

      Re: i feel stupid :)      at net.sourceforge.pmd.util.ResourceLoader.loadResourceAsStream(Resource Loader.java:28)

      Re: i feel stupid :)      at net.sourceforge.pmd.RuleSetFactory.parseRuleNodeWithExclude(RuleSetFa ctory.java:385)

      Re: i feel stupid :)      at net.sourceforge.pmd.RuleSetFactory.parseExternallyDefinedRuleNode(Rul eSetFactory.java:331)

      Re: i feel stupid :)      at net.sourceforge.pmd.RuleSetFactory.parseRuleNode(RuleSetFactory.java: 263)

      Re: i feel stupid :)      at net.sourceforge.pmd.RuleSetFactory.createRuleSet(RuleSetFactory.java: 199)

      Re: i feel stupid :)      at net.sourceforge.pmd.RuleSetFactory.createRuleSet(RuleSetFactory.java: 172)

      Re: i feel stupid :)      at com.adobe.ac.pmd.engines.AbstractFlexPmdEngine.loadRuleset(AbstractFl exPmdEngine.java:181)

      Re: i feel stupid :)      at com.adobe.ac.pmd.engines.AbstractFlexPmdEngine.(AbstractFlexPmdEngine .java:100)

      Re: i feel stupid :)      at com.adobe.ac.pmd.engines.FlexPmdXmlEngine.(FlexPmdXmlEngine.java:58)

      Re: i feel stupid :)      at com.adobe.ac.pmd.ant.FlexPmdAntTask.execute(FlexPmdAntTask.java:58)

      Re: i feel stupid :)      at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)

      Re: i feel stupid :)      at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)

      Re: i feel stupid :)      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces sorImpl.java:25)

      Re: i feel stupid :)      at java.lang.reflect.Method.invoke(Method.java:585)

      Re: i feel stupid :)      at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.jav a:105)

      Re: i feel stupid :)      at org.apache.tools.ant.Task.perform(Task.java:348)

      Re: i feel stupid :)      at org.apache.tools.ant.Target.execute(Target.java:357)

      Re: i feel stupid :)      at org.apache.tools.ant.Target.performTasks(Target.java:385)

      Re: i feel stupid :)      at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)

      Re: i feel stupid :)      at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(Single CheckExecutor.java:38)

      Re: i feel stupid :)      at org.eclipse.ant.internal.launching.remote.EclipseSingleCheckExecutor. executeTargets(EclipseSingleCheckExecutor.java:30)

      Re: i feel stupid :)      at org.apache.tools.ant.Project.executeTargets(Project.java:1181)

      Re: i feel stupid :)      at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:416)

      Re: i feel stupid :)      at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)

      Re: i feel stupid :)      at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)

      Re: i feel stupid :)      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces sorImpl.java:25)

      Re: i feel stupid :)      at java.lang.reflect.Method.invoke(Method.java:585)

      Re: i feel stupid :)      at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.jav a:105)

      Re: i feel stupid :)      at org.apache.tools.ant.Task.perform(Task.java:348)

      Re: i feel stupid :)      at org.apache.tools.ant.Target.execute(Target.java:357)

      Re: i feel stupid :)      at org.apache.tools.ant.Target.performTasks(Target.java:385)

      Re: i feel stupid :)      at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)

      Re: i feel stupid :)      at org.apache.tools.ant.Project.executeTarget(Project.java:1298)

      Re: i feel stupid :)      at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExe cutor.java:41)

      Re: i feel stupid :)      at org.eclipse.ant.internal.launching.remote.EclipseDefaultExecutor.exec uteTargets(EclipseDefaultExecutor.java:32)

      Re: i feel stupid :)      at org.apache.tools.ant.Project.executeTargets(Project.java:1181)

      Re: i feel stupid :)      at org.eclipse.ant.internal.launching.remote.InternalAntRunner.run(Inter nalAntRunner.java:423)

      Re: i feel stupid :)      at org.eclipse.ant.internal.launching.remote.InternalAntRunner.main(Inte rnalAntRunner.java:137)

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 6, 2010 11:09 AM   in reply to Arnoud Bos

    Just curious if anybody has actually used the example ant task/target successfully?  I've seen plenty of blogs and tutorials online, but they all seem to just copy/paste the example ant target provided by Adobe, which leads me to believe they probably haven't used the target.  If you have a successfully running flex pmd ant target, could you post it?

     

    Thanks

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 6, 2010 11:22 AM   in reply to Arnoud Bos

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

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 6, 2010 4:34 PM   in reply to clotton

    Doesn't answer your question but I actually just run the jar file from a macrodef... 

     

          

                   <java jar="${flexpmd.dir}/flex-pmd-command-line-${flexpmd.version}.jar"

                             fork="true" failonerror="true" outputproperty="@">

                        <arg value="-s@"/>

                        <arg value="-o@"/>

                        <arg value="-r@"/>

                         

              <mkdir dir="$/reports/flexpmd" />           <flexPmd                sourceDirectory="$/src"

                   outputDirectory="$/reports/flexpmd"

                   ruleSet="${flexpmd.dir}/rulesets/pmd.xml"

                   outputProperty="flexpmd.out"/>

               

         </target

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 19, 2010 8:51 AM   in reply to Arnoud Bos

    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.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points