tags:

views:

56

answers:

1

I'm rather new to Maven and I often find myself wanting to see what's actually there in terms of goals.

So, is there a command which lists all available goals for e.g. a given prefix?

+2  A: 

Since Maven is an open system of plugins, the best answer is probably "Google" ;-). If you mean all build lifecycle phases, they are static, and can be found at http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html and at other places.

Then, for a given plugin, the help plugin can be used to get the possible goals and all their parameters:

mvn help:describe -DgroupId=org.apache.maven.plugins \
                  -DartifactId=maven-war-plugin \
                  -Ddetail=true

But this doesn't really answer your question, especially the "for a given prefix" part. For this, the best solution might be to use auto completion with BASH (not sure it will be exhaustive though). See for example the Guide to Maven 2.x auto completion using BASH. To get bash completion working under Windows, you'll need CYGWIN. See Maven Tab Auto Completion in Bash for detailed setup steps (and a "better" working auto completion script).

Pascal Thivent
Thanks, that's some great information here. I figured out that you can also pass the 'detail' parameter (as in -Ddetail), which will print a list of all parameters plus description for a goal. Good stuff.
Matthias
You're welcome, glad you find it useful. Regarding the `-Ddetail` parameter, you are absolutely right. Starting with version 2.1, it actually replaces the `-Dfull` from versions 2.0.x. I'll update my answer to reflect that change.
Pascal Thivent