public
Description: Maven CLI Plugin
Home | Edit | New

Home

The Maven CLI Plugin provides an interactive command line interface to Maven plugins, allowing you to execute specific plugin goals, phases, and alias common goal sets on a single project or set of sub-modules. The motivation for this plugin is to reduce the amount of time executing Maven tasks, specifically repeated tasks. The CLI supports command history via the “up” and “down” arrows and tab completion.

The Maven CLI Plugin can also install a special Intellij IDEA plugin to allow you to execute commands with a single keystroke without leaving your IDE.

See the User Guide for more information.

Downloads

You can download the jars, source, and javadocs from the Maven 2 repository:
bq. http://twdata-m2-repository.googlecode.com/svn/org/twdata/maven/maven-cli-plugin/

Difference between execute and execute-phase

Most developers that commonly invoke “mvn install” from the command line will be most at home with the “execute-phase” goal. It interprets your command line inputs and phases you wish to execute. As with the typical maven invocation, a phase will execute any prerequisite phases, so “install” at this goal’s prompt will also run compile, test, jar and package.

The “execute” goal on the other hand, is executing plugins, not phases. So, if you execute “install” from within a ready instance of the execute goal, you’ll find that it expects you to have run compile and jar on your own, manually, or else it will fail. Beneath the covers, “install” at the “execute” goal’s prompt is running “mvn org.apache.maven.plugins:maven-install-plugin:install”

Example Usage

The is the output from using the CLI “execute” goal:

mrdon@makoa:~/dev/maven-cli-plugin$ mvn cli:execute
[INFO] Scanning for projects...
WAGON_VERSION: 1.0-beta-2
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven CLI Plugin
[INFO]    task-segment: [org.twdata.maven:maven-cli-plugin:execute]
[INFO] ------------------------------------------------------------------------
[INFO] [cli:execute]
[INFO] Waiting for commands

maven2> compile
[INFO] Executing: org.apache.maven.plugins:maven-compiler-plugin [compile]
[INFO] [compiler:compile]
[INFO] Nothing to compile - all classes are up to date
[INFO] Execution time: 255 ms

maven2> clean compile
[INFO] Executing: org.apache.maven.plugins:maven-clean-plugin [clean]
[INFO] [clean:clean]
[INFO] Deleting directory /home/mrdon/dev/maven-cli-plugin/target
[INFO] Execution time: 335 ms
[INFO] Executing: org.apache.maven.plugins:maven-compiler-plugin [compile]
[INFO] [compiler:compile {execution: virtual-execution}]
[INFO] Compiling 1 source file to /home/mrdon/dev/maven-cli-plugin/target/classes
[INFO] Execution time: 352 ms

maven2> exit
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2 minutes 
[INFO] Finished at: Sat Aug 02 21:44:09 GMT+10:00 2008
[INFO] Final Memory: 10M/135M
[INFO] ------------------------------------------------------------------------
mrdon@makoa:~/dev/maven-cli-plugin$ 

Maven Repository

Add this to your pom.xml:


<pluginRepositories>
<pluginRepository>
<id>twdata-m2-repository</id>
<name>twdata.org Maven 2 Repository</name>
<url>http://twdata-m2-repository.googlecode.com/svn/</url>
</pluginRepository>
</pluginRepositories>

Last edited by shaolang, Wed Jul 29 04:03:53 -0700 2009
Home | Edit | New
Versions: