无法以多格式生成PMD报告

时间:2015-11-03 04:33:44

标签: maven jenkins pmd

我想使用.csv和.xml格式的maven生成PMD报告。我编辑了我的pom.xml,如下所示:

<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>

如果我遵循正确的配置,请告诉我。 感谢

2 个答案:

答案 0 :(得分:1)

<formats> not exist :

尝试:

    <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

答案 1 :(得分:0)

试试这个:

<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>