[ 
https://issues.apache.org/jira/browse/MPMD-171?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14572417#comment-14572417
 ] 

Andreas Dangel commented on MPMD-171:
-------------------------------------

If I understand you correctly, the pmd site report is correct, but something 
else is not.
According to your pom.xml file: 
https://code.cor-lab.org/projects/rsb/repository/rsb-java/revisions/wip-checks-during-build/entry/pom.xml
 I see, that the maven-pmd-plugin is only configured for the site report, which 
means, that *only for the site report* the configuration is correct. For any 
other means of executing pmd, some defaults will be used (e.g. the default 
rulesets)
I don't see at the moment, how you get any pmd warnings if you just call "mvn 
clean compile" - as the pmd plugin is not configured...
(Caveat: I can actually compile rsb-java, as I don't have the environment 
setup, e.g. rsb-protocol etc.)
I assume, you are calling actually "mvn clean compile pmd:pmd" and then looking 
at the result in "target/site/pmd.html".
If you want to run pmd reports in that way (outside of the site plugin), then 
you'll need to duplicate the pmd configuration AFAIK, e.g. you'll need to 
configure the maven-pmd-plugin under "build/plugins", e.g.

{code}
   <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-pmd-plugin</artifactId>
                <version>3.4</version>
                <configuration>
                    <targetJdk>${target.java.version}</targetJdk>
                    <rulesets>
                        
<ruleset>${project.basedir}/codecheck/pmd-rules.xml</ruleset>
                    </rulesets>
                    <excludeRoots>
                        <excludeRoot>target/generated-protocol</excludeRoot>
                        <excludeRoot>spread-src</excludeRoot>
                    </excludeRoots>
                </configuration>
            </plugin>
...
{code}

If you add this snippet, does this fix your problem?


> Rule properties are ignored when run under MPMD
> -----------------------------------------------
>
>                 Key: MPMD-171
>                 URL: https://issues.apache.org/jira/browse/MPMD-171
>             Project: Maven PMD Plugin
>          Issue Type: Bug
>          Components: PMD
>    Affects Versions: 3.0.1
>         Environment: Linux
>            Reporter: Johannes Wienke
>            Assignee: Michael Osipov
>             Fix For: 3.3, 3.4
>
>
> For our project I have defined a custom ruleset for PMD in an XML file [1]. 
> This ruleset defines properties for some of the standard PMD rules using this 
> syntax:
> {noformat}
> <rule ref="rulesets/java/naming.xml/LongVariable">
>     <properties>
>         <property name="minimum" value="25"/>
>     </properties>
> </rule>
> {noformat}
> When I execute PMD using a parallel ant file we maintain, these custom 
> properties are respected correctly. However, when executing PMD through 
> maven, the properties are completely ignored.
> The pom.xml we are using is available at [2].
> [1] 
> https://code.cor-lab.org/projects/rsb/repository/rsb-java/revisions/7e71d4d3e6d57c8529111a7f7143edeb48ddec59/entry/codecheck/pmd-rules.xml
> [2] 
> https://code.cor-lab.org/projects/rsb/repository/rsb-java/revisions/ff17c0dd008697f70dad27bd0319f4475ab87712/entry/pom.xml



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to