Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [m2e-dev] Lifecycle mapping issue

Hi Ian,

I am not sure if it will be much use but myself and a colleague
recently wrote a m2e extension to support the maven-eclipse-plugin.
This plugin also supports additional natures.  We had a slightly
different scenario in that the maven-eclipse-plugin goals are
generally not bound to any phase.  In the end we bound the
maven-compiler-plugin with a secondaryTo of
"org.eclipse.m2e.jdt.javaConfigurator".

We also found we needed to extend AbstractJavaProjectConfigurator and
override configureRawClasspath rather than use configure in order to
be called after the majority of the project had been configured.

The code is here if it help : https://github.com/SciSysUK/m2eclipse-maveneclipse

BTW, I agree with your concerns, it does feel like this code might be
a little brittle and break if any of the m2e internals change.

Regards,

Phil.


On 10 October 2011 03:54, Ian Robertson <irobertson@xxxxxxxxxxxxx> wrote:
> I'm attempting to write a project configurator for Jamon
> (www.jamon.org), a templating engine which generates java code from
> template sources. Jamon has a maven plugin whose mojo binds to the
> generate-sources phase, but it also has an eclipse plugin, so the
> project configurator, upon detecting the jamon-maven-plugin, should add
> the Jamon nature to the eclipse project.
>
> The problem is that the Jamon nature requires javanature to be on the
> project. It needs to add the generated sources directory to the eclipse
> project's classpath. However, because the jamon-maven-plugin's mojo
> binds to the generate-sources-phase, the Jamon project configurator is
> run prior to the java configurator
> (org.eclipse.m2e.jdt.javaconfigurator). Thus, when trying to add
> "jamonnature" to the project, eclipse complains that jamonnature is
> missing the prerequisite javanature.
>
> Is there a recommended way to handle this sort of situation? The only
> thing I can think of at the moment is to create two configurators. One
> would be a dummy configurator attached to the Jamon mojo; this would
> keep m2e from complaining about the jamon plugin execution not being
> covered. Then attach the "real" Jamon configurator to the
> maven-compiler-plugin as a secondary configurator. While this might
> work, it doesn't feel particularly clean, and I wouldn't be surprised to
> see a kludge like that break in a future release of m2e.
>
>  - Ian
>
> CONFIDENTIALITY NOTICE:  This message is intended only for the use and
> review of the individual or entity to which it is addressed and may contain
> information that is privileged and confidential.  If the reader of this
> message is not the intended recipient, or the employee or agent responsible
> for delivering the message solely to the intended recipient, you are hereby
> notified that any dissemination, distribution or copying of this
> communication is strictly prohibited.  If you have received this
> communication in error, please notify sender immediately by telephone or
> return email.  Thank you.
> _______________________________________________
> m2e-dev mailing list
> m2e-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/m2e-dev
>


Back to the top