The best sources of information are Developing Ant Plugins for Maven 2.x and Maven: The Definitive Guide: Chapter 11 Writing Plugins .
Each ant script requires two files, which have to be named following the conventions for ant plugins:
So if you want to add a new foo-bar
ant script you would create a foo-bar.build.xml
ant script file and foo-bar.mojos.xml
mapping document.
Both these files should be located in the src/main/scripts directory.
If you want to access variables from the component's pom.xml
in the ant script
then you need to do two things in the mapping document
:
<requiresProject>true</requiresProject>
<parameter>
elements for each of the variables you
want to use.
This plugin uses commons
as the goal prefix. So if you add a new foo-bar
goal, then it can be executed on the command line using mvn commons:foo-bar
. This prefix
is defined in this plugin's
pom.xml
.