I'm building a plugin to do some code generation.
I've followed the steps here for how to create a plugin: http://maven.apache.org/guides/plugin/guide-java-plugin-development.html
Plugin Source:
/**
* @goal helloworld
* @phase generate-sources
*/
public class SampleMojo extends AbstractMojo
{
@Override
public void execute() throws MojoExecutionException, MojoFailureException
{
getLog().info("Hello, world.");
}
}
Usage:
<plugins>
<plugin>
<groupId>com.sample</groupId>
<artifactId>sample-maven-plugin</artifactId>
<version>0.0.1</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>helloworld</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
The plugin works fine on its own, but in Eclipse, I keep getting the "not covered by lifecycle" error.
I read through "How to solve “Plugin execution not covered by lifecycle configuration” for Spring Data Maven Builds" and I assumed that if I created my own plugin and set the @phase and @goal annotations it would get rid of that error. I really don't want to put in the "lifecycleMappingMetadata" node in the pom.
Anyone have any advice on this? Is there something special that I need to write for m2e to get that error to go away?
K. Claszen's answer is correct, but I'd like to fill out some extra details.
The point of this behaviour is to prevent m2e from consuming too many resources with incremental (& potentially never-ending) changes.
Currently m2e 1.1 is still a 'milestone'. Users would need to install/upgrade-to it with this update site: http://download.eclipse.org/technology/m2e/milestones/1.1 (I also had to uninstall an 'm2e SCM connector' in order to upgrade it)
Right now, this is potentially more hassle for your users than inserting the 'Quick Fix' snippet in their pom.xml files. But, in the long-term it's good to use it.
As described by K. Claszen, most of the info is here: M2E compatible maven plugins.
Some key points:
If 1.1 isn't a realistic option for your users, you could:
<ignore /> line to <execute />. There are other SO questions/answers which cover this.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With