Maven - Goal

Card Puncher Data Processing


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

Discover More
Card Puncher Data Processing

is a build tool. It is declarative build tool whereas ant is a procedural build tool. You can then change the build process by changing the process not the declaration. Most of the project declaration...
Card Puncher Data Processing
Maven - Assembly (Plugin)

The assembly plugin will build assembly. An “assembly” is a group of files, directories, and dependencies that are assembled into an archive format and distributed. The plugin goals documentation...
Card Puncher Data Processing
Maven - D Argument

The D maven option define: a system property or an argument for a goal.
Card Puncher Data Processing
Maven - Install (Local Package Installation)

Install is a phase that install the generated artifact in the local repository. deploy Plugin that can be used in this phase. install...
Card Puncher Data Processing
Maven - Mvn

-t,--toolchains -U,--update-snapshots Forces a check for updated releases and snapshots on remote repositories -up,--update-plugins Ineffective, only kept for backward compatibility -V,--show-version...
Card Puncher Data Processing
Maven - Package

Packaging in Maven. Package is a phase that bundle the code in a way suitable to be distributed. By default, this phase will take the compiled code and make an archive of it as define in the packaging...
Card Puncher Data Processing
Maven - Phase (Build lifecycle)

A phase is a step in the build lifecycle, which is an ordered sequence of phases. When a phase is given, Maven will execute every phase in the sequence up to and including the one defined. Phases are...
Card Puncher Data Processing
Maven - Plugin (Mojo)

A plugin (in Maven 2.0) groups together goals by code. It's an independent unit of code for Maven. It look like a dependency. In Maven, there are: Build plugins. They will be executed during the...
Card Puncher Data Processing
Maven - Plugin Development

How to develop a maven plugin with Java Annotation. (It's important for the configuration). The code result of this tutorial is on github. gerardnico/helloworld-maven-pluginhelloworld-maven-plugin ...
Maven Execution Id
Maven - Plugin Execution

A plugin execution where: where: executionId see Default ??? default in the POM model default-cli from the command line default-goalName mojo bound to the build lifecycle...

Share this page:
Follow us:
Task Runner