Mike,

Well, at first I thought this was a PMD-only issue also, but that doesn't
jibe with the fact that every other way of running the same version of PMD
on the same code does not throw an exception. The exception _only_ occurs
when PMD is run via the maven-pmd-plugin.  Where would you start looking ;)

Also, we are running the pmd report, with specific rulesets, for a reason,
so simply turning it off or altering the rulesets is undesirable.

Doug

On 6/1/06, Mike Perham <[EMAIL PROTECTED]> wrote:

This is a PMD bug and has nothing to do with Maven.  You can turn off
the "UselessOverridingMethod" rule (see PMD docs) or turn off the entire
PMD report for your particular module like this:

        <reporting>
                <plugins>
                        <plugin>

<artifactId>maven-pmd-plugin</artifactId>
                                <reportSets>
                                        <reportSet>
                                                <reports>

<!--report>pmd</report-->
<report>cpd</report>
                                                </reports>
                                        </reportSet>
                                </reportSets>
                        </plugin>
                </plugins>
        </reporting>

-----Original Message-----
From: Doug Douglass [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 01, 2006 12:34 PM
To: [email protected]
Subject: [m2] NPE with maven-pmd-plugin

I'm getting an NPE when using the maven-pmd-plugin on a specific class,
see maven output below.

   maven: 2.0.3
   maven-pmd-plugin: 2.0-beta-2-SNAPSHOT (20060402.035249-4)

The above version of the PMD plugin uses PMD 3.6.

Using the Eclipse PMD plugin, it successfully analyzes the  class noted
below (WebdavTemplate) (with no warnings above PMDs level 3, BTW). It
appears the Eclipse PMD plugin also uses PMD 3.6.

I grabbed the source of the maven-pmd-plugin (version 2.1-SNAPSHOT) from
trunk, updated it to use PMD 3.7 (only minor mods required, will post to
JIRA soon), installed pmd-3.7.jar with an appropriate pom, built and
installed the plugin and ran the pmd:pmd goal again. No luck, same error
as below.

So, while I don't think that the maven-pmd-plugin is doing something
wrong, I'm thinking it might not be doing everything right.

Any pointers before I dig into the source of PMD to see exactly what's
going on?

Thanks,
Doug


[INFO] Generate "PMD Report" report.
[WARNING] Unable to locate Source XRef to link to - DISABLED [INFO]
------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO]
------------------------------------------------------------------------
[INFO] Error during report generation

Embedded error: Failure executing PMD for:
/home/doug/workspace/compass/components/trunk/compass-content-dao-webdav
/src/main/java/com/hdna/compass/content/webdav/WebdavTemplate.java
[INFO]
------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: Error during
report generation
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(Default
LifecycleExecutor.java:559)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoa
l(DefaultLifecycleExecutor.java:488)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultL
ifecycleExecutor.java:458)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandle
Failures(DefaultLifecycleExecutor.java:306)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(
DefaultLifecycleExecutor.java:273)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifec
ycleExecutor.java:140)
        at
org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:322)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:115)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:256)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at
org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
        at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
        at
org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.plugin.MojoExecutionException: Error during
report generation
        at
org.apache.maven.plugins.site.SiteMojo.execute(SiteMojo.java:389)
        at
org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginMa
nager.java:412)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(Default
LifecycleExecutor.java:534)
        ... 16 more
Caused by: org.apache.maven.reporting.MavenReportException: Failure
executing PMD for:
/home/doug/workspace/compass/components/trunk/compass-content-dao-webdav
/src/main/java/com/hdna/compass/content/webdav/WebdavTemplate.java
        at
org.apache.maven.plugin.pmd.PmdReport.executeReport(PmdReport.java:203)
        at
org.apache.maven.reporting.AbstractMavenReport.generate(AbstractMavenRep
ort.java:98)
        at
org.apache.maven.plugins.site.SiteMojo.generateReportsPages(SiteMojo.jav
a:802)
        at
org.apache.maven.plugins.site.SiteMojo.execute(SiteMojo.java:301)
        ... 18 more
Caused by: java.lang.NullPointerException
        at
net.sourceforge.pmd.rules.UselessOverridingMethod.visit(UselessOverridin
gMethod.java:47)
        at
net.sourceforge.pmd.ast.ASTMethodDeclaration.jjtAccept(ASTMethodDeclarat
ion.java:18)
        at
net.sourceforge.pmd.ast.SimpleJavaNode.childrenAccept(SimpleJavaNode.jav
a:44)
        at
net.sourceforge.pmd.ast.JavaParserVisitorAdapter.visit(JavaParserVisitor
Adapter.java:6)
        at
net.sourceforge.pmd.ast.JavaParserVisitorAdapter.visit(JavaParserVisitor
Adapter.java:47)
        at
net.sourceforge.pmd.ast.ASTClassOrInterfaceBodyDeclaration.jjtAccept(AST
ClassOrInterfaceBodyDeclaration.java:34)
        at
net.sourceforge.pmd.ast.SimpleJavaNode.childrenAccept(SimpleJavaNode.jav
a:44)
        at
net.sourceforge.pmd.ast.JavaParserVisitorAdapter.visit(JavaParserVisitor
Adapter.java:6)
        at
net.sourceforge.pmd.ast.JavaParserVisitorAdapter.visit(JavaParserVisitor
Adapter.java:43)
        at
net.sourceforge.pmd.ast.ASTClassOrInterfaceBody.jjtAccept(ASTClassOrInte
rfaceBody.java:19)
        at
net.sourceforge.pmd.ast.SimpleJavaNode.childrenAccept(SimpleJavaNode.jav
a:44)
        at
net.sourceforge.pmd.ast.JavaParserVisitorAdapter.visit(JavaParserVisitor
Adapter.java:6)
        at
net.sourceforge.pmd.ast.JavaParserVisitorAdapter.visit(JavaParserVisitor
Adapter.java:19)
        at
net.sourceforge.pmd.rules.UselessOverridingMethod.visit(UselessOverridin
gMethod.java:34)
        at
net.sourceforge.pmd.ast.ASTClassOrInterfaceDeclaration.jjtAccept(ASTClas
sOrInterfaceDeclaration.java:18)
        at
net.sourceforge.pmd.ast.SimpleJavaNode.childrenAccept(SimpleJavaNode.jav
a:44)
        at
net.sourceforge.pmd.ast.JavaParserVisitorAdapter.visit(JavaParserVisitor
Adapter.java:6)
        at
net.sourceforge.pmd.ast.JavaParserVisitorAdapter.visit(JavaParserVisitor
Adapter.java:159)
        at
net.sourceforge.pmd.ast.ASTTypeDeclaration.jjtAccept(ASTTypeDeclaration.
java:33)
        at
net.sourceforge.pmd.ast.SimpleJavaNode.childrenAccept(SimpleJavaNode.jav
a:44)
        at
net.sourceforge.pmd.ast.JavaParserVisitorAdapter.visit(JavaParserVisitor
Adapter.java:6)
        at
net.sourceforge.pmd.ast.JavaParserVisitorAdapter.visit(JavaParserVisitor
Adapter.java:135)
        at
net.sourceforge.pmd.AbstractRule.visitAll(AbstractRule.java:183)
        at net.sourceforge.pmd.AbstractRule.apply(AbstractRule.java:144)
        at net.sourceforge.pmd.RuleSet.apply(RuleSet.java:97)
        at net.sourceforge.pmd.RuleSets.apply(RuleSets.java:99)
        at net.sourceforge.pmd.PMD.processFile(PMD.java:104)
        at net.sourceforge.pmd.PMD.processFile(PMD.java:66)
        at net.sourceforge.pmd.PMD.processFile(PMD.java:152)
        at
org.apache.maven.plugin.pmd.PmdReport.executeReport(PmdReport.java:187)
        ... 21 more
[INFO]
------------------------------------------------------------------------
[INFO] Total time: 31 seconds
[INFO] Finished at: Thu Jun 01 07:14:47 MDT 2006 [INFO] Final Memory:
16M/31M [INFO]
------------------------------------------------------------------------

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Reply via email to