Plugin nodes can take dependencies directly. Try this instead:
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId
<artifactId>maven-pmd-plugin</artifactId>
<configuration>
<sourceEncoding>utf-8</
sourceEncoding>
<minimumTokens>100</minimumTokens>
<targetJdk>1.5</targetJdk>
<rulesets>
<ruleset>
src/main/pmd/projectrules.xml</ruleset>
</rulesets>
</configuration>
<dependencies>
<dependency>
<groupId>my.pmd</groupId>
<artifactId>ownpmdrules</artifactId>
<version>0.0.1</version>
</dependency>
</dependencies>
</plugin>
</plugins>
Wayne
On 3/9/07, Leslie Bertels <[EMAIL PROTECTED]> wrote:
Hi,
I've been using Maven2 for a couple of weeks now and I'm trying to
integrate PMD with Maven2.
I've managed to change my pom.xml by adding the pmd plugin and run the mvn
pmd:pmd succesfully.
The following step is to use my own ruleset and classes it depends upon.
I created a jar file containing several classes and a configuration file
containing rulesets.
I installed the jar in my local maven repository and added it as a
dependency in my pom.xml file.
But when running mvn pmd:pmd a exception is thrown because the jar cannot
be found on the classpath.
Does anybody have any idea to refer to a dependency from within a plugin?
Thanks in advance,
Leslie Bertels.
Some extra info:
My pom:
<?xml version="1.0" encoding="UTF-8"?>
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>my.group</groupId>
<artifactId>my.artifact</artifactId>
<version>1.0.0</version>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</
artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId
>
<artifactId>maven-pmd-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>check</goal>
<goal>cpd-check</
goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>my.pmd</groupId>
<artifactId>ownpmdrules</artifactId>
<version>0.0.1</version>
</dependency>
</dependencies>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId
>
<artifactId>maven-pmd-plugin</artifactId>
<configuration>
<sourceEncoding>utf-8</
sourceEncoding>
<minimumTokens>100</minimumTokens>
<targetJdk>1.5</targetJdk>
<rulesets>
<ruleset>
src/main/pmd/projectrules.xml</ruleset>
</rulesets>
</configuration>
</plugin>
</plugins>
</reporting>
</project>
The exception:
[INFO] [pmd:pmd]
[WARNING] Unable to locate Source XRef to link to - DISABLED
net.sourceforge.pmd.RuleSetNotFoundException: Can't find resource
rulesets/hondarules.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:410)
at
net.sourceforge.pmd.RuleSetFactory.parseExternallyDefinedRuleNode(RuleSetFactory.java:356)
at
net.sourceforge.pmd.RuleSetFactory.parseRuleNode(RuleSetFactory.java:294)
at
net.sourceforge.pmd.RuleSetFactory.createRuleSet(RuleSetFactory.java:230)
at
net.sourceforge.pmd.RuleSetFactory.createRuleSet(RuleSetFactory.java:202)
at
org.apache.maven.plugin.pmd.PmdReport.executeReport(PmdReport.java:176)
at
org.apache.maven.reporting.AbstractMavenReport.generate(AbstractMavenReport.java:98)
at
org.apache.maven.reporting.AbstractMavenReport.execute(AbstractMavenReport.java:73)
at
org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:420)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:539)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:493)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:463)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:311)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:278)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:143)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:330)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:123)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:272)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.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)
[INFO]
------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO]
------------------------------------------------------------------------
[INFO] An error has occurred in PMD Report report generation.
The information contained in this communication is confidential and may be
legally privileged. It is intended solely for the use of the individual or the
entity to whom it is addressed and others authorised to receive it. If you have
received it by mistake, please let the sender know by e-mail reply and delete
it from your system.
If you are not the intended recipient you are hereby notified that any
disclosure, copying, distribution or taking any action in reliance of the
contents of this information is strictly prohibited and may be unlawful.
Honda Europe NV is neither liable for the proper and complete transmission of
the information contained in this communication nor for any delay in its
receipt.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]