Copy link to clipboard
Copied
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)
<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
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.
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
Hi thanx for the fast reply.
Does that mean that including the jars in the taskdef of flexPmdAntTask is not sufficient? Now i have:
Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
No, i'm afraid i couldn't get it working.
But glad to hear it's fixed in the next release. It was driving me mad for a whle 🙂
we switched to maven and that's working well.
Anyway great to hear a new version is coming up.
FlexPMD is great! Also sonar flex (build on top of flex pmd) looks really promising!
Arnoud
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
No, the issue is with the ant task, not the eclipse plugin.
Thanks
Copy link to clipboard
Copied
Did you add the ruleset jar to the ant task classpath?
That's all you should need to do.
Xavier
Copy link to clipboard
Copied
Yes, and confirmed its path and spelling is valid. Like Arnoud, I've used the example ant task provided.
Copy link to clipboard
Copied
Just to confirm,
for me it was the ant task too that didn't work.
Arnoud
Copy link to clipboard
Copied
I think it would greatly help to state if the taskdef in the post http://forums.adobe.com/message/2458304#2458304
is correct.
See the last pathelement, that should suffice, right?
do you need to do more?
maybe it's fixed in subsequent releases which i didn't try with ant
Arnoud
Copy link to clipboard
Copied
FYI, I've tried version 1.2, 1.1, and 1.0 with the same result:
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
at net.sourceforge.pmd.util.ResourceLoader.loadResourceAsStream(ResourceLoader.java:28)
at net.sourceforge.pmd.RuleSetFactory.parseRuleNodeWithExclude(RuleSetFactory.java:385)
at net.sourceforge.pmd.RuleSetFactory.parseExternallyDefinedRuleNode(RuleSetFactory.java:331)
at net.sourceforge.pmd.RuleSetFactory.parseRuleNode(RuleSetFactory.java:263)
at net.sourceforge.pmd.RuleSetFactory.createRuleSet(RuleSetFactory.java:199)
at net.sourceforge.pmd.RuleSetFactory.createRuleSet(RuleSetFactory.java:172)
at com.adobe.ac.pmd.engines.AbstractFlexPmdEngine.loadRuleset(AbstractFlexPmdEngine.java:181)
at com.adobe.ac.pmd.engines.AbstractFlexPmdEngine.(AbstractFlexPmdEngine.java:100)
at com.adobe.ac.pmd.engines.FlexPmdXmlEngine.(FlexPmdXmlEngine.java:58)
at com.adobe.ac.pmd.ant.FlexPmdAntTask.execute(FlexPmdAntTask.java:58)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:357)
at org.apache.tools.ant.Target.performTasks(Target.java:385)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
at org.eclipse.ant.internal.launching.remote.EclipseSingleCheckExecutor.executeTargets(EclipseSingleCheckExecutor.java:30)
at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:416)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:357)
at org.apache.tools.ant.Target.performTasks(Target.java:385)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.eclipse.ant.internal.launching.remote.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)
at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
at org.eclipse.ant.internal.launching.remote.InternalAntRunner.run(InternalAntRunner.java:423)
at org.eclipse.ant.internal.launching.remote.InternalAntRunner.main(InternalAntRunner.java:137)
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
I just got it to work by switching to Ant 1.8.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
I can confirm this. Problem is gone in a clean ant 1.8.1 installation
cheers,
Arnoud