If two plugins with the same phase appear in the build section of one POM, then their order matters. If they split in build and a profile, then the order is not guaranteed because there are no in one XML section and so the order cannot be determined. This might be possible in Maven 5. Let's ask such a question regarding Maven 5 in our mailing list. We are developing a new approach in Maven 5 and every problem may help us to make a better design.
Cheers Tibor On Fri, May 7, 2021 at 1:15 AM Alexander Kriegisch <[email protected]> wrote: > I notices an unexpected thing about plugin execution order: If I have > several plugins running in the same phase, normally they are executed in > the lexical order in which they appear in the POM. But there is a case > in which this can change. Schematically, it looks like this: > > <profiles> > <profile P> > <build> > <plugins> > <plugin A, phase X /> > </plugins> > </build> > </profile P> > </profiles> > > <build> > <plugins> > <plugin B, phase X /> > </plugins> > </build> > > My expectation was that the execution order in phase X would be plugin > A, then B. This is true sometimes, depending on which build other > profiles are active. I mean completely unrelated profiles defined in > other Maven modules. In my specific case, without specifying any other > profiles (P is auto-activated bases on non-existence of a file), the > order was B, A. If I manually activated any other profile or > de-activated a profile which otherwise would be active automatically, > the order changed to A, B. > > In my case, I had the option of moving plugin B to a later phase, which > settled the issue for me, but that is not always possible. > > Can anybody enlighten me on what is happening here and if this behaviour > is documented anywhere? Or is this just the "read the freakin' source > code, pal" kind of detail? > > -- > Alexander Kriegisch > https://scrum-master.de > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > >
