How do I list the goals and goal parameters of a maven plugin?
Author: Deron Eriksson
Description: This tutorial describes how to list the goals of a maven plugin and the parameters of the goals.
Tutorial created using: Windows Vista || JDK 1.6.0_04 || Eclipse Web Tools Platform 2.0.1 (Eclipse 3.3.1)


Page:    1 2 >

In another tutorial, we saw how the mavenSW "help:describe" goal could be used to display information about a particular maven plugin. We saw how if we pass it the "medium" parameter, we could get a listing of the goals offered by that plugin. Often, after we have this listing, we need to find out what parameters can be passed to a particular goal in a plugin. We can obtain this information with the "full" parameter, which will result in a display of a plugin description that features all the goals of the plugin and all of the parameters to those goals.

I created an external tool configuration to call the "help:describe" goal with the "full" parameter. This configuration includes a pop-up prompt (string_prompt) that asks for the plugin to describe.

Name:mvn help~describe full
Location:C:\dev\apache-maven-2.0.8\bin\mvn.bat
Working Directory:${workspace_loc}
Arguments:help:describe -Dfull=true -Dplugin=${string_prompt:plugin}

The external tool configuration window is shown here.

External Tool Configuration

I'll select the external tool from the list of external tools to execute it.

Executing External Tool Configuration

When prompted for a plugin to describe, I enter the maven "war" plugin. NOTE: If the plugin isn't already present in your local repository, you may need to fully qualify your maven coordinates for the plugin (ie, instead of "war", you might need to enter something like "org.apache.maven.plugins:maven-war-plugin:2.1-alpha-1").

Specifying war plugin

The lengthy full description of the maven warW plugin is shown here. Notice that all of the goals are listed and all of the parameters for all of the goals.

Console output from 'mvn help:describe -Dplugin=war -Dfull=true'

[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'help'.
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Default Project
[INFO]    task-segment: [help:describe] (aggregator-style)
[INFO] ------------------------------------------------------------------------
[INFO] [help:describe]
[INFO] Plugin: 'org.apache.maven.plugins:maven-war-plugin:2.1-alpha-1'
-----------------------------------------------
Group Id:  org.apache.maven.plugins
Artifact Id: maven-war-plugin
Version:     2.1-alpha-1
Goal Prefix: war
Description:

Maven Plugins

Mojos:

===============================================
Goal: 'exploded'
===============================================
Description:
Generate the exploded webapp

Implementation: org.apache.maven.plugin.war.WarExplodedMojo
Language: java
Bound to Phase: package

Parameters:
-----------------------------------------------

[0] Name: archive
Type: org.apache.maven.archiver.MavenArchiveConfiguration
Required: false
Directly editable: true
Description:
The maven archive configuration to use.

-----------------------------------------------

[1] Name: archiveClasses
Type: boolean
Required: false
Directly editable: true
Description:
Whether a JAR file will be created for the classes in the webapp. Using this optional configuration
parameter will make the generated classes to be archived into a jar file
and the classes directory will then be excluded from the webapp.

-----------------------------------------------

[2] Name: cacheFile
Type: java.io.File
Required: true
Directly editable: true
Description:
The file containing the webapp structure cache.

-----------------------------------------------

[3] Name: classesDirectory
Type: java.io.File
Required: true
Directly editable: false
Description:
The directory containing generated classes.

-----------------------------------------------

[4] Name: containerConfigXML
Type: java.io.File
Required: false
Directly editable: true
Description:
The path to the context.xml file to use.

-----------------------------------------------

[5] Name: dependentWarExcludes
Type: java.lang.String
Required: false
Directly editable: true
Description:
The comma separated list of tokens to exclude when doing
a war overlay.

-----------------------------------------------

[6] Name: dependentWarIncludes
Type: java.lang.String
Required: false
Directly editable: true
Description:
The comma separated list of tokens to include when doing
a war overlay.
Default is '**'

-----------------------------------------------

[7] Name: filters
Type: java.util.List
Required: false
Directly editable: true
Description:
Filters (property files) to include during the interpolation of the pom.xml.

-----------------------------------------------

[8] Name: outputFileNameMapping
Type: java.lang.String
Required: false
Directly editable: true
Description:
The file name mapping to use to copy libraries and tlds. If no file mapping is
set (default) the file is copied with its standard name.

-----------------------------------------------

[9] Name: overlays
Type: java.util.List
Required: false
Directly editable: true
Description:
The overlays to apply.

-----------------------------------------------

[10] Name: project
Type: org.apache.maven.project.MavenProject
Required: true
Directly editable: false
Description:
The maven project.

-----------------------------------------------

[11] Name: useCache
Type: boolean
Required: false
Directly editable: true
Description:
Whether the cache should be used to save the status of the webapp
accross multiple runs.

-----------------------------------------------

[12] Name: warSourceDirectory
Type: java.io.File
Required: true
Directly editable: true
Description:
Single directory for extra files to include in the WAR.

-----------------------------------------------

[13] Name: warSourceExcludes (Alias: excludes)
Type: java.lang.String
Required: false
Directly editable: true
Description:
The comma separated list of tokens to exclude from the WAR.

-----------------------------------------------

[14] Name: warSourceIncludes (Alias: includes)
Type: java.lang.String
Required: false
Directly editable: true
Description:
The comma separated list of tokens to include in the WAR.
Default is '**'.

-----------------------------------------------

[15] Name: webResources
Type: org.apache.maven.model.Resource[]
Required: false
Directly editable: true
Description:
The list of webResources we want to transfer.

-----------------------------------------------

[16] Name: webXml
Type: java.io.File
Required: false
Directly editable: true
Description:
The path to the web.xml file to use.

-----------------------------------------------

[17] Name: webappDirectory
Type: java.io.File
Required: true
Directly editable: true
Description:
The directory where the webapp is built.

-----------------------------------------------

[18] Name: workDirectory
Type: java.io.File
Required: true
Directly editable: true
Description:
Directory to unpack dependent WARs into if needed

-----------------------------------------------

Component Requirements:

-----------------------------------------------
[0] Role: org.codehaus.plexus.archiver.Archiver
Role-Hint: jar

-----------------------------------------------
[1] Role: org.codehaus.plexus.archiver.manager.ArchiverManager

-----------------------------------------------
===============================================


===============================================
Goal: 'inplace'
===============================================
Description:
Generates webapp in the source directory

Implementation: org.apache.maven.plugin.war.WarInPlaceMojo
Language: java

Parameters:
-----------------------------------------------

[0] Name: archive
Type: org.apache.maven.archiver.MavenArchiveConfiguration
Required: false
Directly editable: true
Description:
The maven archive configuration to use.

-----------------------------------------------

[1] Name: archiveClasses
Type: boolean
Required: false
Directly editable: true
Description:
Whether a JAR file will be created for the classes in the webapp. Using this optional configuration
parameter will make the generated classes to be archived into a jar file
and the classes directory will then be excluded from the webapp.

-----------------------------------------------

[2] Name: cacheFile
Type: java.io.File
Required: true
Directly editable: true
Description:
The file containing the webapp structure cache.

-----------------------------------------------

[3] Name: classesDirectory
Type: java.io.File
Required: true
Directly editable: false
Description:
The directory containing generated classes.

-----------------------------------------------

[4] Name: containerConfigXML
Type: java.io.File
Required: false
Directly editable: true
Description:
The path to the context.xml file to use.

-----------------------------------------------

[5] Name: dependentWarExcludes
Type: java.lang.String
Required: false
Directly editable: true
Description:
The comma separated list of tokens to exclude when doing
a war overlay.

-----------------------------------------------

[6] Name: dependentWarIncludes
Type: java.lang.String
Required: false
Directly editable: true
Description:
The comma separated list of tokens to include when doing
a war overlay.
Default is '**'

-----------------------------------------------

[7] Name: filters
Type: java.util.List
Required: false
Directly editable: true
Description:
Filters (property files) to include during the interpolation of the pom.xml.

-----------------------------------------------

[8] Name: outputFileNameMapping
Type: java.lang.String
Required: false
Directly editable: true
Description:
The file name mapping to use to copy libraries and tlds. If no file mapping is
set (default) the file is copied with its standard name.

-----------------------------------------------

[9] Name: overlays
Type: java.util.List
Required: false
Directly editable: true
Description:
The overlays to apply.

-----------------------------------------------

[10] Name: project
Type: org.apache.maven.project.MavenProject
Required: true
Directly editable: false
Description:
The maven project.

-----------------------------------------------

[11] Name: useCache
Type: boolean
Required: false
Directly editable: true
Description:
Whether the cache should be used to save the status of the webapp
accross multiple runs.

-----------------------------------------------

[12] Name: warSourceDirectory
Type: java.io.File
Required: true
Directly editable: true
Description:
Single directory for extra files to include in the WAR.

-----------------------------------------------

[13] Name: warSourceExcludes (Alias: excludes)
Type: java.lang.String
Required: false
Directly editable: true
Description:
The comma separated list of tokens to exclude from the WAR.

-----------------------------------------------

[14] Name: warSourceIncludes (Alias: includes)
Type: java.lang.String
Required: false
Directly editable: true
Description:
The comma separated list of tokens to include in the WAR.
Default is '**'.

-----------------------------------------------

[15] Name: webResources
Type: org.apache.maven.model.Resource[]
Required: false
Directly editable: true
Description:
The list of webResources we want to transfer.

-----------------------------------------------

[16] Name: webXml
Type: java.io.File
Required: false
Directly editable: true
Description:
The path to the web.xml file to use.

-----------------------------------------------

[17] Name: webappDirectory
Type: java.io.File
Required: true
Directly editable: true
Description:
The directory where the webapp is built.

-----------------------------------------------

[18] Name: workDirectory
Type: java.io.File
Required: true
Directly editable: true
Description:
Directory to unpack dependent WARs into if needed

-----------------------------------------------

Component Requirements:

-----------------------------------------------
[0] Role: org.codehaus.plexus.archiver.Archiver
Role-Hint: jar

-----------------------------------------------
[1] Role: org.codehaus.plexus.archiver.manager.ArchiverManager

-----------------------------------------------
===============================================


===============================================
Goal: 'manifest'
===============================================
Description:
Generate a manifest for this WAR.

Implementation: org.apache.maven.plugin.war.WarManifestMojo
Language: java
Bound to Phase: process-resources

Parameters:
-----------------------------------------------

[0] Name: archive
Type: org.apache.maven.archiver.MavenArchiveConfiguration
Required: false
Directly editable: true
Description:
The maven archive configuration to use.

-----------------------------------------------

[1] Name: archiveClasses
Type: boolean
Required: false
Directly editable: true
Description:
Whether a JAR file will be created for the classes in the webapp. Using this optional configuration
parameter will make the generated classes to be archived into a jar file
and the classes directory will then be excluded from the webapp.

-----------------------------------------------

[2] Name: cacheFile
Type: java.io.File
Required: true
Directly editable: true
Description:
The file containing the webapp structure cache.

-----------------------------------------------

[3] Name: classesDirectory
Type: java.io.File
Required: true
Directly editable: false
Description:
The directory containing generated classes.

-----------------------------------------------

[4] Name: containerConfigXML
Type: java.io.File
Required: false
Directly editable: true
Description:
The path to the context.xml file to use.

-----------------------------------------------

[5] Name: dependentWarExcludes
Type: java.lang.String
Required: false
Directly editable: true
Description:
The comma separated list of tokens to exclude when doing
a war overlay.

-----------------------------------------------

[6] Name: dependentWarIncludes
Type: java.lang.String
Required: false
Directly editable: true
Description:
The comma separated list of tokens to include when doing
a war overlay.
Default is '**'

-----------------------------------------------

[7] Name: filters
Type: java.util.List
Required: false
Directly editable: true
Description:
Filters (property files) to include during the interpolation of the pom.xml.

-----------------------------------------------

[8] Name: outputFileNameMapping
Type: java.lang.String
Required: false
Directly editable: true
Description:
The file name mapping to use to copy libraries and tlds. If no file mapping is
set (default) the file is copied with its standard name.

-----------------------------------------------

[9] Name: overlays
Type: java.util.List
Required: false
Directly editable: true
Description:
The overlays to apply.

-----------------------------------------------

[10] Name: project
Type: org.apache.maven.project.MavenProject
Required: true
Directly editable: false
Description:
The maven project.

-----------------------------------------------

[11] Name: useCache
Type: boolean
Required: false
Directly editable: true
Description:
Whether the cache should be used to save the status of the webapp
accross multiple runs.

-----------------------------------------------

[12] Name: warSourceDirectory
Type: java.io.File
Required: true
Directly editable: true
Description:
Single directory for extra files to include in the WAR.

-----------------------------------------------

[13] Name: warSourceExcludes (Alias: excludes)
Type: java.lang.String
Required: false
Directly editable: true
Description:
The comma separated list of tokens to exclude from the WAR.

-----------------------------------------------

[14] Name: warSourceIncludes (Alias: includes)
Type: java.lang.String
Required: false
Directly editable: true
Description:
The comma separated list of tokens to include in the WAR.
Default is '**'.

-----------------------------------------------

[15] Name: webResources
Type: org.apache.maven.model.Resource[]
Required: false
Directly editable: true
Description:
The list of webResources we want to transfer.

-----------------------------------------------

[16] Name: webXml
Type: java.io.File
Required: false
Directly editable: true
Description:
The path to the web.xml file to use.

-----------------------------------------------

[17] Name: webappDirectory
Type: java.io.File
Required: true
Directly editable: true
Description:
The directory where the webapp is built.

-----------------------------------------------

[18] Name: workDirectory
Type: java.io.File
Required: true
Directly editable: true
Description:
Directory to unpack dependent WARs into if needed

-----------------------------------------------

Component Requirements:

-----------------------------------------------
[0] Role: org.codehaus.plexus.archiver.Archiver
Role-Hint: war

-----------------------------------------------
[1] Role: org.codehaus.plexus.archiver.Archiver
Role-Hint: jar

-----------------------------------------------
[2] Role: org.codehaus.plexus.archiver.manager.ArchiverManager

-----------------------------------------------
===============================================


===============================================
Goal: 'war'
===============================================
Description:
Build a war/webapp.

Implementation: org.apache.maven.plugin.war.WarMojo
Language: java
Bound to Phase: package

Parameters:
-----------------------------------------------

[0] Name: archive
Type: org.apache.maven.archiver.MavenArchiveConfiguration
Required: false
Directly editable: true
Description:
The maven archive configuration to use.

-----------------------------------------------

[1] Name: archiveClasses
Type: boolean
Required: false
Directly editable: true
Description:
Whether a JAR file will be created for the classes in the webapp. Using this optional configuration
parameter will make the generated classes to be archived into a jar file
and the classes directory will then be excluded from the webapp.

-----------------------------------------------

[2] Name: cacheFile
Type: java.io.File
Required: true
Directly editable: true
Description:
The file containing the webapp structure cache.

-----------------------------------------------

[3] Name: classesDirectory
Type: java.io.File
Required: true
Directly editable: false
Description:
The directory containing generated classes.

-----------------------------------------------

[4] Name: classifier
Type: java.lang.String
Required: false
Directly editable: true
Description:
Classifier to add to the artifact generated. If given, the artifact will be an attachment instead.

-----------------------------------------------

[5] Name: containerConfigXML
Type: java.io.File
Required: false
Directly editable: true
Description:
The path to the context.xml file to use.

-----------------------------------------------

[6] Name: dependentWarExcludes
Type: java.lang.String
Required: false
Directly editable: true
Description:
The comma separated list of tokens to exclude when doing
a war overlay.

-----------------------------------------------

[7] Name: dependentWarIncludes
Type: java.lang.String
Required: false
Directly editable: true
Description:
The comma separated list of tokens to include when doing
a war overlay.
Default is '**'

-----------------------------------------------

[8] Name: filters
Type: java.util.List
Required: false
Directly editable: true
Description:
Filters (property files) to include during the interpolation of the pom.xml.

-----------------------------------------------

[9] Name: outputDirectory
Type: java.lang.String
Required: true
Directly editable: true
Description:
The directory for the generated WAR.

-----------------------------------------------

[10] Name: outputFileNameMapping
Type: java.lang.String
Required: false
Directly editable: true
Description:
The file name mapping to use to copy libraries and tlds. If no file mapping is
set (default) the file is copied with its standard name.

-----------------------------------------------

[11] Name: overlays
Type: java.util.List
Required: false
Directly editable: true
Description:
The overlays to apply.

-----------------------------------------------

[12] Name: primaryArtifact
Type: boolean
Required: false
Directly editable: true
Description:
Whether this is the main artifact being built. Set to <code>false</code> if you don't want to install or
deploy it to the local repository instead of the default one in an execution.

-----------------------------------------------

[13] Name: project
Type: org.apache.maven.project.MavenProject
Required: true
Directly editable: false
Description:
The maven project.

-----------------------------------------------

[14] Name: useCache
Type: boolean
Required: false
Directly editable: true
Description:
Whether the cache should be used to save the status of the webapp
accross multiple runs.

-----------------------------------------------

[15] Name: warName
Type: java.lang.String
Required: true
Directly editable: true
Description:
The name of the generated WAR.

-----------------------------------------------

[16] Name: warSourceDirectory
Type: java.io.File
Required: true
Directly editable: true
Description:
Single directory for extra files to include in the WAR.

-----------------------------------------------

[17] Name: warSourceExcludes (Alias: excludes)
Type: java.lang.String
Required: false
Directly editable: true
Description:
The comma separated list of tokens to exclude from the WAR.

-----------------------------------------------

[18] Name: warSourceIncludes (Alias: includes)
Type: java.lang.String
Required: false
Directly editable: true
Description:
The comma separated list of tokens to include in the WAR.
Default is '**'.

-----------------------------------------------

[19] Name: webResources
Type: org.apache.maven.model.Resource[]
Required: false
Directly editable: true
Description:
The list of webResources we want to transfer.

-----------------------------------------------

[20] Name: webXml
Type: java.io.File
Required: false
Directly editable: true
Description:
The path to the web.xml file to use.

-----------------------------------------------

[21] Name: webappDirectory
Type: java.io.File
Required: true
Directly editable: true
Description:
The directory where the webapp is built.

-----------------------------------------------

[22] Name: workDirectory
Type: java.io.File
Required: true
Directly editable: true
Description:
Directory to unpack dependent WARs into if needed

-----------------------------------------------

Component Requirements:

-----------------------------------------------
[0] Role: org.apache.maven.project.MavenProjectHelper

-----------------------------------------------
[1] Role: org.codehaus.plexus.archiver.Archiver
Role-Hint: war

-----------------------------------------------
[2] Role: org.codehaus.plexus.archiver.Archiver
Role-Hint: jar

-----------------------------------------------
[3] Role: org.codehaus.plexus.archiver.manager.ArchiverManager

-----------------------------------------------
===============================================


[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: < 1 second
[INFO] Finished at: Sat Feb 09 19:11:39 PST 2008
[INFO] Final Memory: 3M/7M
[INFO] ------------------------------------------------------------------------

Very, very detailed, huh?

(Continued on page 2)

Page:    1 2 >