The contents of this document are a work in progress
If you would like to understand what a Maven Mojo is, please refer to the documentation here on the Maven website.
We noticed that the archetype creator filled in the maven plugin project with some reasonable defaults. It also created a MyMojo placeholder implementation of a Mojo for us, but it doesn't do much for us.
So,
The Mojo source should like this:
public class MonitorMojo
extends AbstractMojo
{
public void execute()
throws MojoExecutionException, MojoFailureException
{
// TODO Auto-generated method stub
}
}
/**
* A Mojo that monitors a given list of websites.
*
* @version $Id: 07_01_implementing_monitor_mojo.apt 3468 2006-07-06 09:24:21Z rahul $
* @goal monitor
*/
public class MonitorMojo
extends AbstractMojo
{
public void execute()
throws MojoExecutionException, MojoFailureException
{
// TODO Auto-generated method stub
}
}
/**
* A Mojo that monitors a given list of websites.
*
* @version $Id: 07_01_implementing_monitor_mojo.apt 3468 2006-07-06 09:24:21Z rahul $
* @goal monitor
*/
public class MonitorMojo
extends AbstractMojo
{
/**
* The website monitor component instance that will be injected
* by the Plexus runtime.
* @component
*/
private WebsiteMonitor monitor;
public void execute()
throws MojoExecutionException, MojoFailureException
{
// TODO Auto-generated method stub
}
}
Say, for instance we had a different website monitor implementation to monitor FTP websites, the Javadoc annotation for that Mojo field will look like the snippet below.
Of course, the value of role-hint provided in the code snippet reproduced below should have been defined for the website monitor's implementation's component descriptor that monitors FTP sites.
Again the Plexus runtime does the magic of injecting the appropriate implementation.
/**
* A Mojo that monitors a given list of websites.
*
* @version $Id: 07_01_implementing_monitor_mojo.apt 3468 2006-07-06 09:24:21Z rahul $
* @goal monitor
*/
public class MonitorMojo
extends AbstractMojo
{
/**
* The website monitor component instance that will be injected
* by the Plexus runtime.
* @component role-hint="ftp"
*/
private WebsiteMonitor monitor;
public void execute()
throws MojoExecutionException, MojoFailureException
{
// TODO Auto-generated method stub
}
}