You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Hilco Wijbenga <hi...@gmail.com> on 2009/10/23 01:45:37 UTC

Re: Sharing PMD rule set between maven-pmd-plugin and Eclipse PMD plugin

2009/10/22 Brett Porter <br...@apache.org>:
> It does work as a plugin dependency, but I'm not sure about that for eclipse
> (though presumably if you have that resources project open, you can point it
> directly at the file).

AFAICT, the Eclipse plugin is rather limited in what it supports. I
have only been able to add an absolute path to a rule set.

> The example is the same as at the bottom of this page for Checkstyle:
> http://maven.apache.org/plugins/maven-checkstyle-plugin/examples/custom-developed-checkstyle.html

Yes, I know about this. :-) Here's what I tried and doesn't work:

pmd-ruleset:
src/main/resources/rulesets/da.xml (full set of rules; this is what
Eclipse generates so I expect it to be okay)

my-project pom.xml (snippets only):
<dependency>
  <artifactId>pmd-ruleset</artifactId>
</dependency>
<plugin>
  <artifactId>maven-pmd-plugin</artifactId>
  <configuration>
    <rulesets>
      <ruleset>/rulesets/da.xml</ruleset>
    </rulesets>
  </configuration>
</plugin>

The plugin then complains that it can't find da.xml. I've also tried
it with the dependency directly under the plugin.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Sharing PMD rule set between maven-pmd-plugin and Eclipse PMD plugin

Posted by Brett Porter <br...@apache.org>.
On 23/10/2009, at 11:39 AM, Hilco Wijbenga wrote:

>>
>> It needs to be under <plugin>, in the <build> section (not the  
>> <reporting>
>> section, and not the <pluginManagement> section).
>>
>> Here is a working example from the Effective Implementation book:
>> http://github.com/brettporter/centrepoint/blob/master/centrepoint/modules/pom.xml
>
> Weird, that's exactly what I have. I even changed "rulesets" to "pmd"
> to match what you have (just in case). Maven doesn't find it. I'll
> have to try it at home with a smaller project.
>

A possible problem under Maven 2 is if you have multiple instances of  
the plugin declared as the classloader of the first one is always  
used. That's why the above is in the root project of all that will use  
it. You might also consider it in a organization POM (just  
configuration and deps, not executions) to ensure it is shared.

- Brett


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Sharing PMD rule set between maven-pmd-plugin and Eclipse PMD plugin

Posted by Hilco Wijbenga <hi...@gmail.com>.
2009/10/22 Brett Porter <br...@apache.org>:
>
> On 23/10/2009, at 10:45 AM, Hilco Wijbenga wrote:
>
>> Yes, I know about this. :-) Here's what I tried and doesn't work:
>>
>> pmd-ruleset:
>> src/main/resources/rulesets/da.xml (full set of rules; this is what
>> Eclipse generates so I expect it to be okay)
>>
>> my-project pom.xml (snippets only):
>> <dependency>
>>  <artifactId>pmd-ruleset</artifactId>
>> </dependency>
>> <plugin>
>>  <artifactId>maven-pmd-plugin</artifactId>
>>  <configuration>
>>   <rulesets>
>>     <ruleset>/rulesets/da.xml</ruleset>
>>   </rulesets>
>>  </configuration>
>> </plugin>
>>
>> The plugin then complains that it can't find da.xml. I've also tried
>> it with the dependency directly under the plugin.
>>
>
> It needs to be under <plugin>, in the <build> section (not the <reporting>
> section, and not the <pluginManagement> section).
>
> Here is a working example from the Effective Implementation book:
> http://github.com/brettporter/centrepoint/blob/master/centrepoint/modules/pom.xml

Weird, that's exactly what I have. I even changed "rulesets" to "pmd"
to match what you have (just in case). Maven doesn't find it. I'll
have to try it at home with a smaller project.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Sharing PMD rule set between maven-pmd-plugin and Eclipse PMD plugin

Posted by Brett Porter <br...@apache.org>.
On 23/10/2009, at 10:45 AM, Hilco Wijbenga wrote:

> Yes, I know about this. :-) Here's what I tried and doesn't work:
>
> pmd-ruleset:
> src/main/resources/rulesets/da.xml (full set of rules; this is what
> Eclipse generates so I expect it to be okay)
>
> my-project pom.xml (snippets only):
> <dependency>
>  <artifactId>pmd-ruleset</artifactId>
> </dependency>
> <plugin>
>  <artifactId>maven-pmd-plugin</artifactId>
>  <configuration>
>    <rulesets>
>      <ruleset>/rulesets/da.xml</ruleset>
>    </rulesets>
>  </configuration>
> </plugin>
>
> The plugin then complains that it can't find da.xml. I've also tried
> it with the dependency directly under the plugin.
>

It needs to be under <plugin>, in the <build> section (not the  
<reporting> section, and not the <pluginManagement> section).

Here is a working example from the Effective Implementation book: http://github.com/brettporter/centrepoint/blob/master/centrepoint/modules/pom.xml

- Brett


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Sharing PMD rule set between maven-pmd-plugin and Eclipse PMD plugin

Posted by Wayne Fay <wa...@gmail.com>.
> AFAICT, the Eclipse plugin is rather limited in what it supports. I
> have only been able to add an absolute path to a rule set.

Last I checked, the PMD plugins you mentioned are both open source. So
if this isn't currently possible, tweak the code and submit a patch.
;-)

Based on your comments, it sounds like the Eclipse PMD plugin could
use some help/contributions to bring it up to par with the Maven PMD
plugin... so I'd start there.

Wayne

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org