I'm developing a new mojo. It has only one goal so it seems logical not to force a user to add an executions section (if they don't want to change a default phase).
This should be possible because when I add a very simple description of a surefire plugin, maven understands that its single goal test should be run, i.e.:
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.4.3</version> </plugin> and this is enough to run the plugin.
How can I achieve similarly small configuration for my plugin?
Here is what I have now (and it doesn't work without executions section):
/** * * @goal test * @phase test */ public class MyMojoPlugin extends AbstractMojo { ... (implementation details) } <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>org.somegroup</groupId> <artifactId>mymojo-maven-plugin</artifactId> <packaging>maven-plugin</packaging> <version>1.0-SNAPSHOT</version> <dependencies> <dependency> <groupId>org.apache.maven</groupId> <artifactId>maven-plugin-api</artifactId> <version>2.0</version> </dependency> .... (other dependencies) </dependencies> <build> <plugins> ... (some plugins) </plugins> </build> </project>