right, sorry by the noise, I didn't look well at the stacktrace to find which method was used
at com.jayway.maven.plugins.android.phase_prebuild.ClasspathModifierLifecyclePartici pant.afterProjectsRead(ClasspathModifierLifecycleParticipant.java:78) now I understand, thank you Hervé Le mercredi 21 mai 2014 07:51:56 Igor Fedorenko a écrit : > I am absolutely certain that all project build extensions are loaded by > the time participant#afterProjectsRead is called, and this is the > callback used in William's example. Setting correct TCCL makes his > example work. > > You are correct, however, that participant#afterSessionStart is invoked > before projects are read and their build extension realms are setup. > This callback is only useful for Maven core extensions deployed in > $M2_HOME/lib/ext and via -Dmaven.ext.class.path system property. > > -- > Regards, > Igor > > On 2014-05-21, 2:41, Hervé BOUTEMY wrote: > > no, extension are not loaded on this precise method: there is a TODO in > > the > > interface about this, and when you read DefaultMaven, you see the reason > > why this method can't have extensions = too early = the TODO comment > > > > Regards, > > > > Hervé > > > > Le mardi 20 mai 2014 21:20:36 Igor Fedorenko a écrit : > >> MavenLifecycleParticipant comes from a build extension, so build > >> extensions are loaded for sure. > >> > >> Most likely the problem has to do with thread context classloader, you > >> need to set it to project extensions realm (as returned by > >> MavenProject.getClassRealm) to be able to lookup project build > >> extensions. And don't forget to restore TCCL in finally block ;-) > >> > >> -- > >> Regards, > >> Igor > >> > >> On 2014-05-20, 20:27, William Ferguson wrote: > >>> Hi Herve, > >>> > >>> I am using MLCP#afterProjectsRead. > >>> Unfortunately the extensions don't seem to be loaded at that point > >>> either. > >>> > >>> William > >>> > >>> On Wed, May 21, 2014 at 10:03 AM, Hervé BOUTEMY > > > > <herve.bout...@free.fr>wrote: > >>>> if you look at AbstractMavenLifecycleParticipant source file: > >>>> /** > >>>> > >>>> * Invoked after MavenSession instance has been created. > >>>> * > >>>> * This callback is intended to allow extensions to inject > >>>> execution > >>>> > >>>> properties, > >>>> > >>>> * activate profiles and perform similar tasks that affect > >>>> MavenProject > >>>> * instance construction. > >>>> */ > >>>> > >>>> // TODO: This is too early for build extensions, so maybe just > >>>> remove > >>>> > >>>> it? > >>>> > >>>> public void afterSessionStart( MavenSession session ) > >>>> > >>>> throws MavenExecutionException > >>>> > >>>> { > >>>> > >>>> the TODO seems exactly what you're facing > >>>> > >>>> and if you have a look at place where it is used, ie > >>>> DefaultMaven.doExecute(...), you'll see that this method happens really > >>>> too > >>>> early to be able to do anything about this problem > >>>> > >>>> IMHO, you'd better use afterProjectsRead(...) method, which should have > >>>> the > >>>> right classloader prepared > >>>> > >>>> and we should probably change the "TODO" into javadoc, since this shuld > >>>> be > >>>> documented limitation > >>>> > >>>> WDYT? > >>>> > >>>> Regards, > >>>> > >>>> Hervé > >>>> > >>>> Le lundi 19 mai 2014 11:31:42 William Ferguson a écrit : > >>>>> So it boils down to ProjectDependenciesResolver being able to resolve > >>>>> an > >>>>> s3wagon dependency from a Mojo, but not from > >>>>> MavenLifecycleParticipant. > >>>>> > >>>>> Is it because RepositorySystem has not been fully configured by > >>>>> MLCP#afterProjectsRead? > >>>>> If so, is there a way to ensure that it is configured by then? > >>>>> > >>>>> Someone, anyone? > >>>>> > >>>>> William > >>>>> > >>>>> > >>>>> On Sun, May 18, 2014 at 9:23 AM, William Ferguson < > >>>>> > >>>>> william.fergu...@xandar.com.au> wrote: > >>>>>> OK, I'm really hoping someone can provide some more insight on this > >>>>>> as > >>>> > >>>> I > >>>> > >>>>>> have reached my limit. > >>>>>> > >>>>>> To make things clearer, I have created a project containing