Search code examples
mavenjenkinspmd

Unable to generate PMD Reports in multi-format


I want to generate PMD Reports using maven in .csv and .xml format. I edited my pom.xml as below:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-pmd-plugin</artifactId>
    <version>3.1</version>
    <configuration>
        <formats>
            <format>csv</format>
            <format>xml</format>
        </formats>
        <rulesets>
            <ruleset>../PMD_RuleSet/PMDRules.xml</ruleset>
        </rulesets>
    </configuration>
</plugin>

Please let me know if I am following the correct configuration. Thanks


Solution

  • <formats> not exist :
    

    Try:

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-pmd-plugin</artifactId>
            <version>3.1</version>
            <configuration> 
                <rulesets>
                    <ruleset>../PMD_RuleSet/PMDRules.xml</ruleset>
                </rulesets>
            </configuration>
        </plugin>
    
        Execute : mvn clean pmd:pmd -Dformat=csv
        Execute : mvn clean pmd:pmd -Dformat=xml