[
https://jira.codehaus.org/browse/MPMD-132?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=325735#comment-325735
]
Derek Lewis commented on MPMD-132:
----------------------------------
It's been a while since I was trying to do this, but if I remember right:
It looks to me that because PMD and CPD are part of the same plugin, it is not
possible to configure them differently. (For example: to run PMD on everything,
but run CPD on main only, not tests.)
I've attached a new example, with three profiles:
1. with-pmd
With this profile, PMD runs on main and test, and fails because of an unused
import in the tests.
2. with-cpd
With this profile, CPD runs on only main, and passes. (If CPD were to run on
tests, it will fail.)
3. with-pmd-and-cpd
This profile is simply the plugin blocks from with-pmd and with-cpd both. This
passes. For some reason, PMD is not run on the tests, despite having
"<includeTests>true</includeTests>" in the configuration (outside of the
execution).
What is even stranger to me is that running with both with-pmd and with-cpd
enabled, the build *does* fail with a PMD error. I'm not sure why this, and
the with-pmd-and-cpd profile behaves differently.
It looks like configuring PMD and CPD in separate profiles may be a workaround,
to allow configuring them differently.
> 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-2.zip, 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
For more information on JIRA, see: http://www.atlassian.com/software/jira