How do I execute a maven goal I've written using shorthand?
Author: Deron Eriksson
Description: This tutorial describes how to execute a maven goal that you've written without needing to specify the full coordinate to the plugin.
Tutorial created using: Windows Vista || JDK 1.6.0_04 || Eclipse Web Tools Platform 2.0.1 (Eclipse 3.3.1)

In a previous tutorial, we wrote a mavenSW plugin/goal with groupId "com.maventest", artifactId "maven-howdy-plugin", goal "howdy-world", and version "1.0-SNAPSHOT" and installed this in our local maven repository.

We can call this goal if we're in a maven project and we call "mvn com.maventest:maven-howdy-plugin:howdy-world".

mvn com.maventest:maven-howdy-plugin:howdy-world

However, if we try to call the goal using maven 'shorthand' by calling "mvn howdy:howdy-world", we'll receive an error.

Error calling 'mvn howdy:howdy-world'

By default, this shorthand is only allowed for plugins with groupIds of "org.apache.maven.plugins" or "org.codehaus.mojo". However, we can add our group to this list by adding our plugin groupId as a pluginGroup in a pluginGroups section of our settings.xml file:

Fragment of settings.xml


After this addition of "com.maventest" as a pluginGroup in settings.xml, I can now execute the goal using maven shorthand. Here, I'll call "mvn howdy:howdy-world", and it now works.

Executing 'mvn howdy:howdy-world'