How does Maven understand gf prefixed goals like gf:run?

From Kedar:

In other words, how does gf:run really run? To understand what goes on here, one must understand Maven in the context of plugins. At the core, Maven is a plugin execution framework. Thus, Maven finds plugins and executes associated goals. A plugin is generally implemented as what's called a Mojo. If you look at the plugins available at the central Maven Plugin Repository, you'll find that there are plugins written for:

  • common tasks
  • several open-source projects such as Eclipse

(As an aside, we should take up the task of writing Maven plugins for GlassFish. Currently, we have no presence/plan about this. In general, I think, going ahead, the GlassFish Maven plugins are going to replace our ANT tasks. This is a good opportunity for us to do something in this regard).

Anyway, a few plugins have already been written. They are in the "build" module of v3 source. To understand what these plugins are, in any module of the work-space, just perform:

mvn -o help:describe -DgroupId=org.glassfish.build -DartifactId=maven-glassfish-plugin -Dfull=true

You'll see output such as:

...
===============================================
Goal: 'assemble'
===============================================
Description:
Creates a glassfish distribution image.

Implementation: com.sun.enterprise.build.DistributionAssemblyMojo
Language: java
Bound to Phase: package

...

This means that during the package phase of the build, to attain a goal assemble, this particular plugin and corresponding Mojo will be selected and executed by the maven framework.