0

What is the best way for using JaCoCo in Maven phases? I mean what's phase I should choose to run JaCoCo in my ci pipeline? Test phase or verify? What is the difference between the two types of using? I have three execution sections in my POM file.

             <executions>
                <execution>
                    <id>default-prepare-agent</id>
                    <goals>
                        <goal>prepare-agent</goal>
                    </goals>
                </execution>
                <execution>
                    <id>report</id>
                    <phase>verify</phase>
                    <goals>
                        <goal>report</goal>
                    </goals>
                    <configuration>
                        <outputDirectory>target/jacoco-report</outputDirectory>
                    </configuration>
                </execution>
                <execution>
                    <id>check</id>
                    <phase>test</phase>
                    <goals>
                        <goal>check</goal>
                    </goals>
                </execution>
            </executions>

And I don't understand how should I choose phase for each execuction section.

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
Victor Levin
  • 238
  • 2
  • 7
  • 3
    What's wrong with the defaults? – OneCricketeer Oct 07 '21 at 15:14
  • 2
    Convention over configuration...keep the phases the jacoco maintainer think it's best...most of the time the do right... – khmarbaise Oct 07 '21 at 15:16
  • As you've done with `prepare-agent`, it's not necessary to specify a phase. If you don't, the plugin author will have defined a default phase. In most cases those defaults are what you want anyway – Michael Oct 07 '21 at 15:22

0 Answers0