Ayush
Ayush

Reputation: 81

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

Upvotes: 0

Views: 763

Answers (2)

question_maven_com
question_maven_com

Reputation: 2475

<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

Upvotes: 1

question_maven_com
question_maven_com

Reputation: 2475

Try this:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-pmd-plugin</artifactId>
    <version>3.5</version> 
     <executions>
      <execution>
         <id>default-pmd</id>
        <goals>
          <goal>pmd</goal>
        </goals>
        <configuration>
          <format>xml</format>
        </configuration>
      </execution>
      <execution>
        <id>format_csv</id>
        <goals>
          <goal>pmd or check or cpd-check</goal>
        </goals>
        <configuration>
          <format>csv</format>
        </configuration>
      </execution>
    </executions>  
</plugin>

Upvotes: 0

Related Questions