SAGARFIVE

Tutorials

4.7 Maven Goal

  • When we run a phase, all goals bound to this phase are executed in order.
  • Here are some of the phases and default goals bound to them:
  • compiler:compile – the compile goal from the compiler plugin is bound to the compile phase
  • compiler:testCompile is bound to the test-compile phase
  • surefire:test is bound to the test phase
  • install:install is bound to the install phase
  • jar:jar and war:war is bound to the package phase
  • We can list all goals bound to a specific phase and their plugins using the command:

mvn help:describe -Dcmd=PHASENAME

  • For example, to list all goals bound to the compile phase, we can run:

mvn help:describe -Dcmd=compile

Example : build in pom.xml

<build>
<plugins>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${maven.failsafe.version}</version>
<executions> <execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>

</execution> </executions>
</plugin>
</plugins>
</build>