This interface forms the contract required for Mojos to interact with the Maven infrastructure. It features an execute() method, which triggers the Mojo's build-process behavior, and can throw a MojoExecutionException or MojoFailureException if error condit
| 31 | * @author Jason van Zyl |
| 32 | */ |
| 33 | public interface Mojo { |
| 34 | /** The component <code>role</code> hint for Plexus container */ |
| 35 | String ROLE = Mojo.class.getName(); |
| 36 | |
| 37 | /** |
| 38 | * Perform whatever build-process behavior this <code>Mojo</code> implements.<br> |
| 39 | * This is the main trigger for the <code>Mojo</code> inside the <code>Maven</code> system, and allows |
| 40 | * the <code>Mojo</code> to communicate errors. |
| 41 | * |
| 42 | * @throws MojoExecutionException if an unexpected problem occurs. |
| 43 | * Throwing this exception causes a "BUILD ERROR" message to be displayed. |
| 44 | * @throws MojoFailureException if an expected problem (such as a compilation failure) occurs. |
| 45 | * Throwing this exception causes a "BUILD FAILURE" message to be displayed. |
| 46 | */ |
| 47 | void execute() throws MojoExecutionException, MojoFailureException; |
| 48 | |
| 49 | /** |
| 50 | * Inject a standard <code>Maven</code> logging mechanism to allow this <code>Mojo</code> to communicate events |
| 51 | * and feedback to the user. |
| 52 | * |
| 53 | * @param log a new logger |
| 54 | */ |
| 55 | // TODO not sure about this here, and may want a getLog on here as well/instead |
| 56 | void setLog(Log log); |
| 57 | |
| 58 | /** |
| 59 | * Furnish access to the standard Maven logging mechanism which is managed in this base class. |
| 60 | * |
| 61 | * @return a log4j-like logger object which allows plugins to create messages at levels of <code>"debug"</code>, |
| 62 | * <code>"info"</code>, <code>"warn"</code>, and <code>"error"</code>. This logger is the accepted means to display |
| 63 | * information to the user. |
| 64 | */ |
| 65 | Log getLog(); |
| 66 | } |
no test coverage detected
searching dependent graphs…