Listing Available Goals

When you use Maven, you will be executing goals. A Maven plug-in is a set of related goals. For example, to create a JAR from a project, you would execute the jar:jar goal from the JAR plug-in as follows:

C:\dev\mavenbook\code\genapp> maven jar:jar

The jar before the colon separator classifies this goal as belonging to the JAR plug-in. To see a list of all the goals in the JAR plug-in, enter the following command:

C:\dev\mavenbook\code\genapp> maven -P jar
 _ _  _ _
|  \/  |_ _ _Apache_ _ _ _ _
| |\/| / _` \ V / -_) ' \  ~ intelligent projects ~
|_|  |_\_ _,_|\_/\_ _ _|_||_|  v. 1.0.2
  
Goals in jar
=  =  =  =  =  =  =  =  =  =  =  =
  
[jar]                               Create the deliverable jar file.
  deploy  ......................... Deploy a jar to the remote repository
  deploy-snapshot  ................ Deploy a snapshot jar to the remote
                                    repository
  install  ........................ Install the jar in the local repository
  install-snapshot  ............... Install a snapshot jar in the local
                                    repository
  jar  ............................ Create the deliverable jar file.
  snapshot  ....................... Create a snapshot jar, ie '
                                    id-YYYYMMDD.hhmmss.jar'
  
Plugin for creating JAR files. Requires Maven 1.0 RC2.

If you need to see a list of every available plug-in and goal, type the following:

C:\dev\mavenbook\code\genapp\test-application> maven -g | more

The entire list of plug-ins is a little daunting, as Maven has plug-ins for just about everything, from generating project files for different IDEs to generating WAR files to starting and stopping an application server. You will learn about some of the more useful plug-ins in the following labs.

Get Maven: A Developer's Notebook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.