I am developing a new mojo. It has only one purpose, so itβs logical not to force the user to add the executions
section (unless they want to change the default value of phase
).
This should be possible because when I add a very simple description of the surefire
plugin, maven realizes that its only test
target should be running, surefire
.:
<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 the same small configuration for my plugin?
Here is what I have (and it does not work without the executions
section):
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>
source share