Exactly, that is the case. - afterSessionStart is a maven extension, - afterProjectRead is a project extension, which in the end is quite confusing…
Tom On Mar 6, 2012, at 11:09 PM, Jeff MAURY wrote: > It seems quite confusing: Tycho is using this functionality and does not > require to be installed in M2_HOME/lib/ext. > My understanding is the following: > - for afterSessionStart, must be installed in M2_HOME/lib/ext > - for afterProjectRead, can be an extension in the POM > > Jeff > > On Tue, Mar 6, 2012 at 10:51 PM, Olivier Lamy <ol...@apache.org> wrote: > >> 2012/3/6 Tom Bujok <tom.bu...@gmail.com>: >>> Hi guys, >>> >>> I have implemented an AbstractMavenLifecycleParticipant to customize the >> standard build behavior a bit. >>> The declaration of the participant looks like this: >>> >>> @Component(role = AbstractMavenLifecycleParticipant.class, hint = >> "testParticipant") >>> public class TestParticipant extends AbstractMavenLifecycleParticipant >>> implements Initializable { >>> … >>> } >>> >>> I have noticed, however, that the afterSessionStart method is never >> invoked. I debugged the getLifecycleParticipants method in the >> DefaultMaven.java class and it looks like an class-loading issue. >>> Container.lookupList( AbstractMavenLifecycleParticipant.class ) method >> fetches my participant only when the context class loader is set to project >> realm's class loader, basically after this stuff is executed: >>> ClassLoader projectRealm = project.getClassRealm(); >>> Thread.currentThread().setContextClassLoader( projectRealm ); >>> >>> afterSessionStart() method, however, is invoked before the projects are >> read, so in general, it look like it is impossible to use the >> "afterSessionStart" method from a plugin defined in a project... >>> Am I right, or maybe I am missing something? I am willing to provide a >> patch if you explain what the default behavior should be. >> AFAIK AbstractMavenLifecycleParticipant are maven extension (i.e. >> placed in $M2_HOME/lib/ext/ ) and not project extension. >> And btw afterSessionStart is executed before reading project so >> "project realm" is unknown at this stage. >>> >>> Thanks in advance, >>> Tom Bujok >>> >>> >>> >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org >>> For additional commands, e-mail: users-h...@maven.apache.org >>> >> >> >> >> -- >> Olivier Lamy >> Talend: http://coders.talend.com >> http://twitter.com/olamy | http://linkedin.com/in/olamy >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org >> For additional commands, e-mail: users-h...@maven.apache.org >> >> > > > -- > Jeff MAURY > > "Legacy code" often differs from its suggested alternative by actually > working and scaling. > - Bjarne Stroustrup > > http://www.jeffmaury.com > http://riadiscuss.jeffmaury.com > http://www.twitter.com/jeffmaury --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org