Faster testing with the Maven CLI plugin

maven tools

Although it's not that new, I discovered Don Brown's Maven CLI plugin only this morning, and played with mojavelinux' s enhanced version which supports -D parameters and profiles, among other things.

The great thing is to be able to run a simple test or test -D MyTest command quickly. You first start Maven with mvn cli:execute-phase, which gives you a maven2> command prompt to start Maven lifecycle phases. As Maven is already started, phases run much quicker than when starting from scratch.

In my experiments, the test command ran about five times faster than using mvn -o test, but the difference depends how fast your tests are, of course.

To setup the plugin, I'm adding the following to my settings.xml, so as to not interfere with project's POMs, as the CLI is more an environment feature than a project thing:

org.twdata.maven cli-plugin true JBoss Repository

Find more info on the mojavelinux page.

Great tool - thanks Don Brown and mojavelinux!