【问题标题】:How to execute maven plugin in given phase如何在给定阶段执行maven插件
【发布时间】:2014-03-29 20:26:54
【问题描述】:

我想将所有可靠的报告汇总到单独的模块中。在我的文件夹中有几个模块,我想生成所有这些模块的汇总肯定报告。当我在父文件夹中执行以下命令时,我可以做到这一点。

mvn surefire-report:report -Daggregate=true

我想在执行的时候做同样的操作

mvn clean install

在我的父文件夹中。为此,我必须更改父文件夹 pox.xml 文件。

我发现它可以使用以下 maven 插件

<build>
    <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-report-plugin</artifactId>
                <version>2.7.2</version>
                <configuration>
                    <aggregate>true</aggregate>
                </configuration>
            </plugin>
            ...............

但是当我执行时

mvn clean install 

没有结果。除了将插件添加到 pom.xml 之外还有其他步骤吗?或者这条路是否正确?

谢谢,

【问题讨论】:

标签: java maven build maven-plugin maven-surefire-plugin


【解决方案1】:

试试这个

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-report-plugin</artifactId>
            <version>2.7.2</version>
            <configuration>
                <aggregate>true</aggregate>
            </configuration>
            <executions>
                <execution>
                    <phase>install</phase>
                    <goals>
                        <goal>report</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

【讨论】:

  • 我必须把它放在 里面吗?
  • 当然,就像你的问题一样
  • 我只是把你给的代码段放在中。但是当我执行 [ mvn clean install ] 它不会生成聚合报告为 [ mvn surefire-report:report -Daggregate=true ]
  • 它应该在目标/站点中生成surefire-report.html
  • 它不会使用 [ mvn clean install ] 创建目标文件夹。我应该添加任何其他内容吗?
猜你喜欢
  • 2011-04-14
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-07-17
  • 2012-01-26
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多