Thank you for the example. I have not yet determined why mine still does
not work!
I'm sure the support dir is at the top level of the jar (for
support/rules-pmd.xml), but should check - is that true?
(I also tried using and not using the leading slash for its package).
Running with -X gives this:
...
[DEBUG] Adding to extension classpath: C:\Documents and
Settings\jjensen\.m2\repository\pmd\pmdcustomrules\1.2\pmdcustomrules-1.2.ja
r
...
/me not a good toString() here:
[DEBUG] (s) rulesets = [Ljava.lang.String;@8e4805
...
[INFO] Generating "PMD Report" report.
[DEBUG] Preparing ruleset: rulesets/pmdruleset.xml
[DEBUG] Before: rulesets/pmdruleset.xml After: pmdruleset.xml
[DEBUG] URLResourceLoader: Exception when looking for
'rulesets/pmdruleset.xml' at ''
java.net.MalformedURLException: no protocol: rulesets/pmdruleset.xml
at java.net.URL.<init>(URL.java:567)
at java.net.URL.<init>(URL.java:464)
at java.net.URL.<init>(URL.java:413)
at
org.codehaus.plexus.resource.loader.URLResourceLoader.getResourceAsInputStre
am(URLResourceLoader.java:45)
A probable irrelevant question, but just in case: Do you have anything in
the MANIFEST.MF of the custom rules jar for this to work?
Here is mine in case you notice something.
<extensions>
<extension>
<!-- custom PMD rules -->
<groupId>pmd</groupId>
<artifactId>pmdcustomrules</artifactId>
<version>1.2</version>
</extension>
</extensions>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>2.2</version>
<configuration>
<rulesets>
<ruleset>rulesets/pmdruleset.xml</ruleset>
<ruleset>rulesets/xxx.xml</ruleset>
</rulesets>
<minimumPriority>10</minimumPriority>
<targetJdk>1.4</targetJdk>
<linkXRef>true</linkXRef>
<verbose>true</verbose>
</configuration>
</plugin>
</plugins>
</reporting>
> -----Original Message-----
> From: Jean-Baptiste Defard [mailto:[EMAIL PROTECTED]
> Sent: Sunday, January 06, 2008 1:22 PM
> To: 'Maven Users List'
> Subject: RE: [m2] PMD plugin and custom rulesets
>
> Not directly. This pom work fine for me:
>
> <build>
> <extensions>
> <extension>
> <groupId>XXX</groupId>
> <artifactId>build-support</artifactId>
> <version>1.0</version>
> </extension>
> </extensions>
> </build>
> <reporting>
> <plugins>
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-pmd-plugin</artifactId>
> <version>2.2</version>
> <configuration>
> <linkXref>true</linkXref>
> <sourceEncoding>iso8859-1</sourceEncoding>
> <minimumTokens>50</minimumTokens>
> <targetJdk>1.5</targetJdk>
> <verbose>true</verbose>
> <excludes>
>
> <exclude>**/generated/*.java</exclude>
> </excludes>
> <rulesets>
> <ruleset>
> support/rules-pmd.xml
> </ruleset>
> </rulesets>
> </configuration>
> </plugin>
> </plugins>
> </reporting>
>
> >-----Message d'origine-----
> >De : Jeff Jensen [mailto:[EMAIL PROTECTED]
> >Envoyé : dimanche 6 janvier 2008 19:39
> >À : 'Maven Users List'
> >Objet : RE: [m2] PMD plugin and custom rulesets
> >
> >Thanks for the reply.
> >
> >Does the reporting section/site goal utilize that? I tried your
> >suggestion
> >but still receive the error.
> >
> >
> >> -----Original Message-----
> >> From: Jean-Baptiste Defard [mailto:[EMAIL PROTECTED]
> >> Sent: Sunday, January 06, 2008 11:35 AM
> >> To: 'Maven Users List'
> >> Subject: RE: [m2] PMD plugin and custom rulesets
> >>
> >> Try putting in the build section:
> >> <extensions>
> >> <extension>
> >> <groupId>pmd</groupId>
> >> <artifactId>pmdcustomrules</artifactId>
> >> <version>1.2</version>
> >> </extension>
> >> </extensions>
> >>
> >> --
> >> JB.
> >>
> >> >-----Message d'origine-----
> >> >De : Jeff Jensen [mailto:[EMAIL PROTECTED]
> >> >Envoyé : dimanche 6 janvier 2008 18:06
> >> >À : 'Maven Users List'
> >> >Objet : [m2] PMD plugin and custom rulesets
> >> >
> >> >I have a jar for custom PMD rules; it has Java classes and the XML
> >> >rulesets.
> >> >The rulesets are in a top-level "/rulesets" dir.
> >> >
> >> >I have the jar as a POM dependency:
> >> > <dependency>
> >> > <groupId>pmd</groupId>
> >> > <artifactId>pmdcustomrules</artifactId>
> >> > <version>1.2</version>
> >> > </dependency>
> >> >
> >> >I have the rulesets configured in the <reporting> section for the PMD
> >> >plugin:
> >> > <plugin>
> >> > <groupId>org.apache.maven.plugins</groupId>
> >> > <artifactId>maven-pmd-plugin</artifactId>
> >> > <configuration>
> >> > <rulesets>
> >> > <ruleset>/rulesets/pmdruleset.xml</ruleset>
> >> > <ruleset>/rulesets/anotherset.xml</ruleset>
> >> > </rulesets>
> >> > <targetJdk>1.4</targetJdk>
> >> > </configuration>
> >> > </plugin>
> >> > </plugins>
> >> >
> >> >Running "mvn site" yields this error:
> >> > Embedded error: Error rendering Maven report: Could not find
> >resource
> >> >'/rulesets/pmdruleset.xml'.
> >> >
> >> >
> >> >Am I missing further configuration to get the custom rulesets on the
> >> >classpath?
> >> >
> >> >
> >> >The Maven PMD docs say rulesets are loadable from the classpath, so I
> >> >assume
> >> >this is a feasible approach I am taking...
> >> >But the docs also say custom rulesets require an absolute path (which
> >> >contradicts loading from the classpath statement, unless it means
> >only
> >> >the
> >> >PMD jar rulesets).
> >> >Specifying a hardcoded path to the rulesets in the jar is not a
> >"nice"
> >> >thing
> >> >to do, as they are in a jar in the local repo!
> >> >
> >> >The Maven PMD plugin version is 2.2. I didn't see any JIRA issues
> >that
> >> >address this problem in 2.2 or the forthcoming 2.3.
> >> >
> >> >(I'm converting a product from m1 to m2. This setup works nicely for
> >m1
> >> >and
> >> >hope to do the same with m2.)
> >> >
> >> >
> >> >
> >> >
> >> >---------------------------------------------------------------------
> >> >To unsubscribe, e-mail: [EMAIL PROTECTED]
> >> >For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: [EMAIL PROTECTED]
> >For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]