[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [m2e-dev] how to add m2eclipse support to maven plugin that generates code
|
To add some details to this,
Overall code generation support in m2e consists of two pieces of code.
A project configurator is responsible for configuration of java source
and classpath entries, natures, builders and other static aspects of
workspace project configuration. You most likely want to subclass
AbstractJavaProjectConfigurator [1], which will setup project source
folders based on "outputDirectory" mojo configuration parameter value.
You can override #getOutputFolderParameterName or #getSourceFolders if
your mojo uses different parameter name or requires more sophisticated
calculation of generated source folder location(s). Project
configurators are also responsible to return build participant instances
(see below).
A build participant is responsible for running code generation during
Eclipse workspace build. Although MojoExecutionBuildParticipant [2]
provides reasonable basic behaviour a subclass is necessary to implement
worksapce refresh and optionally incremental build support. You can use
AntlrBuildParticipant [3] as an example how to implement incremental
build support and workspace refresh.
Once you have project configurator and build participant implementation,
you need to register them with m2e and declare what Maven plugin
execution they should be associated with. This is done in plugin.xml
file like [4] and lifecycle-mapping-metadata.xml like [5]. With these in
place, m2e is expected to invoke your project configurator during
project import and configuration update and execute your build
participant during workspace build.
Let us know if you have any further questions.
[1]
http://git.eclipse.org/c/m2e/m2e-core.git/tree/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/AbstractJavaProjectConfigurator.java
[2]
http://git.eclipse.org/c/m2e/m2e-core.git/tree/org.eclipse.m2e.core/src/org/eclipse/m2e/core/project/configurator/MojoExecutionBuildParticipant.java
[3]
https://github.com/sonatype/m2eclipse-extras/blob/master/org.sonatype.m2e.antlr/src/org/sonatype/m2e/antlr/internal/AntlrBuildParticipant.java
[4]
https://github.com/sonatype/m2eclipse-extras/blob/master/org.sonatype.m2e.antlr/plugin.xml.
[5]
https://github.com/sonatype/m2eclipse-extras/blob/master/org.sonatype.m2e.antlr/lifecycle-mapping-metadata.xml
--
Regards,
Igor
On 11-05-18 05:35 PM, Vlad Tatavu wrote:
To start, u can take a look at the plugin that adds support for modello
in https://github.com/sonatype/m2eclipse-extras
Vlad
On 5/18/2011 3:46 PM, Leonardo Uribe wrote:
Hi
In this issue:
https://issues.sonatype.org/browse/MNGECLIPSE-2289
the following answer was sent:
"... We've changed the way m2e executes maven plugins in 0.13 and now
all code generation mojos require explicit m2e support. We expect
relatively small (<100 LOC) amount of code for each mojo, and if you
are interested to work on this please raise your hand on
m2e-dev_at_eclipse.org mailing list and we'll provide pointers where
to start.... "
I have a couple of maven plugins that generates some code and I would
like to know how to add m2e support. Somebody knows how to do that?
I'll appreaciate any help you can give me.
regards,
Leonardo Uribe