Hi Igor,
Thanks for the responses on this subject - I really appreciate them.
However I'm having difficulties still. You said:
m2e does not directly execute Maven build lifecycle, so
AbstractMavenLifecycleParticipant will not be called be default, at
least I do not believe it will.
On further investigation I concur, I do not believe that my AbstractMavenLifecycleParticipant.afterProjectsRead method is invoked from within m2e.
Do you think it should be i.e. should I raise a ticket on this? AbstractMavenLifecycleParticipant is a Maven 3 feature that may be reasonable to support.
Have a look at ILifecycleMapping2 and AbstractMavenDependencyResolver.
AbstractMavenDependencyResolver.resolveProjectDependencies is called
right after m2e read MavenProject instance and I think it can be used to
execute AbstractMavenLifecycleParticipant.afterProjectsRead.
I've had a look, but I'm wondering if AbstractMavenLifecycleParticipant.afterProjectsRead needs to be invoked somewhere higher up i.e. after all projects have been read in (parents/modules). In Maven, this method is invoked from org.apache.maven.DefaultMaven as part of the doExecute of a MavenExecutionRequest.
On a related topic, how do I pull in the m2e libraries that I require in my project. I tried the following but to no avail:
<dependency> <groupId>org.eclipse.m2e</groupId> <artifactId>org.eclipse.m2e.core</artifactId> <version>1.0.0</version> <scope>provided</scope> </dependency>
...and...
<repositories> <repository> <id>eclipse</id> <url> http://download.eclipse.org/releases/indigo</url> <layout>p2</layout> </repository> <repository> <id>m2e</id> <url>http://download.eclipse.org/technology/m2e/releases/1.0</url> <layout>p2</layout> </repository> </repositories> Thanks again for your help. I feel I'm nearly there...
Kind regards, Christopher |