Maven - Goal


A goal is the execution part of a plugin. An individual plugin may have multiple goals. Each goal may have a separate configuration.

If you are familiar with Ant, a goal is similar to a task.

A goal can dependant upon parameters defined in the pom.xml For instance, maven will executes jar:jar if the packaging type of the project is a JAR, and war:war if the packaging type of the project is a WAR.

Since Maven 3.0.3, for two plug-ins bound to the same phase, the order of execution is the same as the order in which you define them in the pom file.



Inside the build node of the pom.xl

    <defaultGoal>clean verify apache-rat:check clirr:check javadoc:javadoc</defaultGoal>


Format syntax

mvn prefix:goal
:: or as the goal default to the name of the prefix
mvn prefix
  • with the fully-qualified name:
mvn groupId:artifactId:version:goal
# mvn org.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy-file


  • version is by default the latest
  • groupId optionally takes its default

Executing the phase where the goal is/was bind will also execute the goal

mvn phase


A goal is bind to a project's build lifecycle in the pom.xml file.

See the phase element below.

<project xmlns="" 
						<phase>package</phase> <!-- bind to the packaging phase -->

Documentation / Reference

Powered by ComboStrap