2012/3/6 Tom Bujok <[email protected]>: > 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: [email protected] > For additional commands, e-mail: [email protected] >
-- Olivier Lamy Talend: http://coders.talend.com http://twitter.com/olamy | http://linkedin.com/in/olamy --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
