Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [tycho-user] Invoke a participant before TychoMavenLifecycleParticipant - is it possible?

Hi Tom,

just played a little bit around and figured out, that when I place my plugin/extension declaration above the declaration of Tycho my participant will be invoked after Tycho... but when I place my declaration beneath Tycho my participant will be invoked before Tycho.

Actually, I'm not pretty sure if the ordering of the objects returned by Plexus (actually Guice) is not guaranteed. Maven uses either LinkedHashSet or Lists for lifecycle participants and - if I'm not mistaken - Guice is aware of the order in which objects are bound by the different modules. Maven is using a strategy that relies on the order of the "extension" classpath to bind components contributed by extensions (which in turn relies on the order in which the extensions/plugins are declared in the pom.xml), so the order will always be the same. -> My speculation: The ordering of the lifecycle participants equates to the order of the extensions in the pom but reversed, because Guice follows the LIFO principle???

Regards,
Bernd

2012/3/6 Tom Bujok <tom.bujok@xxxxxxxxx>
Hi,

Thanks for your answer Bernd. My plugin is defined above tycho in the pom, but with LifecycleParticipants it doesn't work that way.
The mechanism relies on the Plexus container since maven invokes: plexusContainer.lookupList( AbstractMavenLifecycleParticipant.class ) - the order in which the method returns objects is not guaranteed…

The second option would do the trick, but I want the project to be self-contained - the requirements to copy jars into maven ext is unfortunately unacceptable for me.

I was thinking of extending tycho and adding some kind of a listener invocation at the beginning and at the end of the TychoLifecycleParticipant method - otherwise the maven principle of ordering processing steps is broken when you use tycho. Would you accept a patch? Or maybe I should ask it a tycho-dev list?

Thanks anyway,
Tom



On Mar 6, 2012, at 11:25 AM, Bernd Vogt wrote:

Hi,

try to declare your plugin/extension above the tycho plugin in your pom... first come first serve... at least this applies to the execution order of plugins...

Another way is to devlop a "Maven Core Extension" and but it under ${maven.home}/lib/ext/ (since Maven 3.0.3). If you do so, the AbstractMavenLifecycleParticipant#afterSessionStart(...) method will be invoked beside #afterProjectsRead(...) also. And both methods will be invoked before the TychoMavenLifecycleParticipant methods.

Regards,
Bernd



2012/3/6 Tom Bujok <tom.bujok@xxxxxxxxx>
Hi guys,

I am writing a maven plugin to customize my tycho build a bit.
The tricky part is that my plugin has to be invoked before any tycho plugin. I checked that you guys use the TychoMavenLifecycleParticipant to do all your project configuration before any other plugin is invoked.
Whenever I register my own AbstractMavenLifecycleParticipants it is invoked after the tycho's participant. Is there a way to hook-in at an earlier stage or use some plexus trickery to order the participants -  to make sure that my participant is invoked before any other participant?

Thanks in advance,
Tom Bujok


_______________________________________________
tycho-user mailing list
tycho-user@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/tycho-user

_______________________________________________
tycho-user mailing list
tycho-user@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/tycho-user


_______________________________________________
tycho-user mailing list
tycho-user@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/tycho-user



Back to the top