How to execute maven plugin in given phase

build, java, maven, maven-plugin, maven-surefire-plugin

Solution

try this

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

Problem

I want to aggregate all surefire reports in separate modules. In my folder there are several module and I want to generate aggregated surefire report of all those modules. I could do this when I execute following command inside the my parent folder. ``` mvn surefire-report:report -Daggregate=true ``` I want to do the same operation when I execute ``` mvn clean install ``` inside my parent folder. For that I have to change the parent folder pox.xml file. I found it can be using following maven plugin ``` <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> ............... ``` But when I execute ``` mvn clean install ``` There is no result. In addition to add the plugin to the pom.xml is there any other steps to do ? Or is this path correct ? Thanks,

Original source

Related problems