【问题标题】:Maven PMD plugin reporting not going to correct directoryMaven PMD 插件报告不会正确目录
【发布时间】:2015-04-09 09:14:51
【问题描述】:

我的 pom.xml 下有以下配置设置来生成 PMD 代码分析报告:

<pluginManagement>
<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-pmd-plugin</artifactId>
                <version>3.4</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>pmd</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>code-analysis/reports/html</outputDirectory>
                            <targetDirectory>code-analysis/reports/</targetDirectory>
                            <aggregate>true</aggregate>
                            <rulesets>
                                <ruleset>code-analysis/rulesets/pmd-custom-rules.xml</ruleset>
                            </rulesets>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </pluginManagement>

但是在我运行 mvn pmd:pmd 之后,我没有在我想要的 outputDirectory 中得到报告。设置aggregate=true 是否只为maven 下的所有子项目生成1 个报告?如何配置它以便它只生成 1 个报告到我想要的输出目录?

【问题讨论】:

    标签: maven-2 maven-plugin maven-release-plugin pmd


    【解决方案1】:

    在 Maven 中,不可能通过执行 (Id) 来运行目标,这只能通过分阶段调用来实现。因此,如果您想从命令行运行 pmd:pmd 并进行特定配置,请将配置移到执行块之外。现在它变成了通用配置。会是这样的:

    <plugin>
       <groupId>org.apache.maven.plugins</groupId>
       <artifactId>maven-pmd-plugin</artifactId>
       <version>3.4</version>
       <configuration>
          ...
       </configuration>
    </plugin>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-09-16
      • 1970-01-01
      • 1970-01-01
      • 2018-01-29
      • 1970-01-01
      • 2017-03-12
      相关资源
      最近更新 更多