[ https://jira.codehaus.org/browse/MPMD-132?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=315815#comment-315815 ]
Dennis Lundberg commented on MPMD-132: -------------------------------------- If you take a closer look at the documentation you will see that the "check" goal does not have the "rulesets" configuration option. http://maven.apache.org/plugins/maven-pmd-plugin/check-mojo.html I'll try to explain what is happening here. In the profile "with-pmd-and-cpd" you do not configure <rulesets> directly under the plugin configuration, but rather under the execution. This means that the configuration is only available to the execution of the "check" report goal. That goal in turn calls the "pmd" goal, but that goal does not inherit the <rulesets> configuration. In the profile "with-pmd-that-works" you configure <rulesets> directly under the plugin configuration. This means that the configuration is inherited by the "check" report goal. When that goal in turn calls the "pmd" goal it will have the <rulesets> configuration. In order for this to work the way you want it to, one would need to add a <reporting> section within the profile that configures the <rulesets> for the "pmd" goal correctly. Unfortunately this will not work either, because of the structure of maven-pmd-plugin and the way Maven works. This is partly because you cannot tie a report to an execution in Maven and partly because the cpd and pmd parts of this plugin shares their configuration. > Cannot configure multiple executions (ie. cpd, pmd) independantly > ----------------------------------------------------------------- > > Key: MPMD-132 > URL: https://jira.codehaus.org/browse/MPMD-132 > Project: Maven 2.x PMD Plugin > Issue Type: Bug > Components: CPD, PMD > Affects Versions: 2.5 > Reporter: Derek Lewis > Attachments: maven-pmd-plugin-bug.zip > > > When trying to configure cpd and pmd differently (ie. includeTests for PMD, > but not for CPD), the plugin does not honour configuration within the > execution. > For example, if a ruleset file is specified in <configuration> within the > <execution>, it is ignored, and the default ruleset is applied. > In the testcase: > $ mvn install > ^ This fails with a PMD error, because the ruleset is ignored due to the > <configuration> being within the <execution> > $ mvn install -Pwith-pmd-that-works > ^ This passes, because it is a profile where the <configuration> is within > <plugin>, not <execution> -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://jira.codehaus.org/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira