如何在给定阶段执行 maven 插件

Mal*_*tha 3 java build maven-plugin maven maven-surefire-plugin

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

mvn surefire-report:report -Daggregate=true
Run Code Online (Sandbox Code Playgroud)

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

mvn clean install
Run Code Online (Sandbox Code Playgroud)

在我的父文件夹中。为此,我必须更改父文件夹 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>
            ...............
Run Code Online (Sandbox Code Playgroud)

但是当我执行

mvn clean install 
Run Code Online (Sandbox Code Playgroud)

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

谢谢,

Evg*_*eev 6

尝试这个

        <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>
Run Code Online (Sandbox Code Playgroud)