You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Jim Garrison <ji...@nwea.org> on 2014/06/03 21:48:07 UTC

Controlling order of plugin execution

I'm trying to set up a Maven build for CI/CD, and one of the requirements for testing is to create, populate and tweak a database schema.

This involves interleaving various executions of maven-dependency-plugin, sql-maven-plugin and exec-maven-plugin, and there aren't enough lifecycle phases *-test-[re]sources to accommodate all the steps. 

I'd like to bind six executions as follows:

    1 maven-dependency-plugin:unpack -> generate-test-resources
    2 sql-maven-plugin:execute       -> generate-test-resources
    3 sql-maven-plugin:execute       -> generate-test-resources
    4 exec-maven-plugin:exec         -> process-test-resources
    5 exec-maven-plugin:exec         -> process-test-resources
    6 sql-maven-plugin:execute       -> process-test-resources

But this doesn't work as Maven wants to execute sql-maven-plugin (steps 2 & 3) before step 1 and I can't find a way to make it do things in the desired sequence.

There's a bug in Jira for this http://jira.codehaus.org/browse/MNG-3522 but it was closed as part of the "great Jira cleanup of 2014".

This has been an issue for several years but seems to get no attention.  I don't think I should be required to write my own plugin to do what should be a common requirement.

Can someone explain if there's an approved way to accomplish this? 

I know Maven is supposed to be declarative in nature, but sequencing steps seems like a basic requirement.  From the lack of attention, and from reading other posts in places like StackOverflow, it appears there may be a philosophical objection to explicitly ordering executions.  Can someone explain the reasoning for this?

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Controlling order of plugin execution

Posted by Stephen Connolly <st...@gmail.com>.
On Wednesday, 4 June 2014, Jim Garrison <ji...@nwea.org> wrote:

> > -----Original Message-----
> > From: Stephen Connolly [mailto:stephen.alan.connolly@gmail.com
> <javascript:;>]
> > Sent: Wednesday, June 04, 2014 9:08 AM
> > To: Maven Users List
> > Subject: Re: Controlling order of plugin execution
> >
> > That's usually a sign that you have wandered off The Maven Way™
> >
> > There are ways back onto the blessed path... they typically involve
> > writing
> > a plugin
> >
> >
> > On 4 June 2014 16:47, jhgnwea <jim.garrison@nwea.org <javascript:;>>
> wrote:
> >
> > > Paul Benedict wrote
> > > > I agree with Dan. Last I check, IIRC, the order of operations of
> > plugins
> > > > is
> > > > defined by their sequential order in the POM. However, I also find
> > this a
> > > > bit problematic with inheritance -- I don't know off the top of my
> > head
> > > > what happens then.
> > >
> > > Ordering applies only for executions of a single plugin.  If you
> > need to
> > > interleave executions of two or more plugins you're out of luck.
> > Say you
> > > have two plugins, exec-maven and maven-sql, and want to run
> > >
> > >     exec-maven A1
> > >     maven-sql B1
> > >     exec-maven A2
> > >     maven-sql B2
> > >
> > > A1 and A2 will run in that order, and (B1, B2) will be ordered, but
> > you
> > > can't control which set (A or B) runs first without horribly abusing
> > the
> > > phase bindings.  And, if you have a more complex sequence with 3
> > plugins
> > > and multiple executions of each, there aren't enough available
> > phases to
> > > successfully order everything.
> > >
> > > It should be possible to bind multiple plugin executions, of
> > DIFFERENT
> > > plugins, to a single phase and deterministically specify the
> > execution
> > > order.
>
> Sorry, I disagree.  One alternative is to use antrun, but that seems like
> going backwards.  I'm really curious why there's a strong philosophical
> objection to requesting this enhancement.
>
> Is it unreasonable to suggest that "The Maven Way" is not perfect and
> might need some adjustments to handle common use-cases the original
> designers didn't foresee?
>
> Is my goal of using Maven to automate CI/CD, which can involve configuring
> external resources by running various plugins in a specific sequence,
> somehow in violation of "the Maven way"?


See I just knew it was going to be something like deploying to multiple
environments or other things that are outside the standard lifecycle...

So let's take a step back and see if you are actually hacking the standard
lifecycle to do something outside of its original intended use case?

Are you doing things that should happen before publishing the artifacts to
a remote repository or after publishing? (And try to forget how you think
maven should work, rather look at the higher level)

Publishing to a remote repository is allowing others to consume the
artifact as is, without changing it.

Are you reconfiguring the artifact for use in different environments? (That
should better be a separate customisation module that consumes the
previously published artifact)

I have yet to see a genuine use case where a refactoring leads to a better
build process and remove the need to do multiple things in the same
phase... Ever case I have seen is either a refactoring to multiple modules
or writing a plugin to perform the complex sequence of steps for a specific
*class* of artifact where multiple of this class of artifacts is required
(ie the write a plugin solution)

Usually the root cause is people trying to make their builds overly complex.

If you are doing maven right you should only have the packaging,
dependencies and a build extension in you pom (yes slight hyperbole here,
but think of this as the ideal)


> Consider the phrase "...you have wandered off The Maven Way™".  I can't
> tell if you intended this ironically or seriously.  If it's the latter, it
> seems like you're saying is "Maven is perfect. If Maven doesn't handle your
> use-case, then your use-case is invalid".  Is that true?
>

Nope maven is far from perfect. Plugins are the path to that perfection


-- 
Sent from my phone

Re: Controlling order of plugin execution

Posted by Laird Nelson <lj...@gmail.com>.
On Wed, Jun 4, 2014 at 12:08 PM, Jim Garrison <ji...@nwea.org> wrote:

> Consider the phrase "...you have wandered off The Maven Way™".  I can't
> tell if you intended this ironically or seriously.  If it's the latter, it
> seems like you're saying is "Maven is perfect. If Maven doesn't handle your
> use-case, then your use-case is invalid".  Is that true?
>

Just observing this conversation.  The so-called Maven Way™ can probably be
reduced to: favor new plugins over more XML in your pom.xml files.

I think (my interpretation only; this and $4 will get you a cup of coffee)
this is because at least originally—and for what it's worth it still seems
this way to me—your pom.xml is supposed to be a declarative object model.
 It's not really a place for stitching together plugin executions.  The
thinking is (again, for better or worse; don't shoot the messenger) that if
you have some sequence of events that must take place at a particular point
in the lifecycle, then encapsulate that sequence of events into a plugin
and bind it once.

Of course that presupposes a certain amount of ease-of-software-reuse in
the plugin ecosystem—i.e. that it's brain-dead simple to write a plugin
that combines other plugins—which may or may not actually be true depending
on how the to-be-combined plugins were actually authored.

Best,
Laird

-- 
http://about.me/lairdnelson

Re: Controlling order of plugin execution

Posted by Dan Tran <da...@gmail.com>.
@Jim,

Does my suggestion work for you?

@Stephen

you statement is confusing, are you suggesting to combine a bunch of mojo
executions in one plugin?

-D


On Wed, Jun 4, 2014 at 12:08 PM, Jim Garrison <ji...@nwea.org> wrote:

> > -----Original Message-----
> > From: Stephen Connolly [mailto:stephen.alan.connolly@gmail.com]
> > Sent: Wednesday, June 04, 2014 9:08 AM
> > To: Maven Users List
> > Subject: Re: Controlling order of plugin execution
> >
> > That's usually a sign that you have wandered off The Maven Way™
> >
> > There are ways back onto the blessed path... they typically involve
> > writing
> > a plugin
> >
> >
> > On 4 June 2014 16:47, jhgnwea <ji...@nwea.org> wrote:
> >
> > > Paul Benedict wrote
> > > > I agree with Dan. Last I check, IIRC, the order of operations of
> > plugins
> > > > is
> > > > defined by their sequential order in the POM. However, I also find
> > this a
> > > > bit problematic with inheritance -- I don't know off the top of my
> > head
> > > > what happens then.
> > >
> > > Ordering applies only for executions of a single plugin.  If you
> > need to
> > > interleave executions of two or more plugins you're out of luck.
> > Say you
> > > have two plugins, exec-maven and maven-sql, and want to run
> > >
> > >     exec-maven A1
> > >     maven-sql B1
> > >     exec-maven A2
> > >     maven-sql B2
> > >
> > > A1 and A2 will run in that order, and (B1, B2) will be ordered, but
> > you
> > > can't control which set (A or B) runs first without horribly abusing
> > the
> > > phase bindings.  And, if you have a more complex sequence with 3
> > plugins
> > > and multiple executions of each, there aren't enough available
> > phases to
> > > successfully order everything.
> > >
> > > It should be possible to bind multiple plugin executions, of
> > DIFFERENT
> > > plugins, to a single phase and deterministically specify the
> > execution
> > > order.
>
> Sorry, I disagree.  One alternative is to use antrun, but that seems like
> going backwards.  I'm really curious why there's a strong philosophical
> objection to requesting this enhancement.
>
> Is it unreasonable to suggest that "The Maven Way" is not perfect and
> might need some adjustments to handle common use-cases the original
> designers didn't foresee?
>
> Is my goal of using Maven to automate CI/CD, which can involve configuring
> external resources by running various plugins in a specific sequence,
> somehow in violation of "the Maven way"?
>
> Consider the phrase "...you have wandered off The Maven Way™".  I can't
> tell if you intended this ironically or seriously.  If it's the latter, it
> seems like you're saying is "Maven is perfect. If Maven doesn't handle your
> use-case, then your use-case is invalid".  Is that true?
>

RE: Controlling order of plugin execution

Posted by Jim Garrison <ji...@nwea.org>.
> -----Original Message-----
> From: Stephen Connolly [mailto:stephen.alan.connolly@gmail.com]
> Sent: Wednesday, June 04, 2014 9:08 AM
> To: Maven Users List
> Subject: Re: Controlling order of plugin execution
> 
> That's usually a sign that you have wandered off The Maven Way™
> 
> There are ways back onto the blessed path... they typically involve
> writing
> a plugin
> 
> 
> On 4 June 2014 16:47, jhgnwea <ji...@nwea.org> wrote:
> 
> > Paul Benedict wrote
> > > I agree with Dan. Last I check, IIRC, the order of operations of
> plugins
> > > is
> > > defined by their sequential order in the POM. However, I also find
> this a
> > > bit problematic with inheritance -- I don't know off the top of my
> head
> > > what happens then.
> >
> > Ordering applies only for executions of a single plugin.  If you
> need to
> > interleave executions of two or more plugins you're out of luck.
> Say you
> > have two plugins, exec-maven and maven-sql, and want to run
> >
> >     exec-maven A1
> >     maven-sql B1
> >     exec-maven A2
> >     maven-sql B2
> >
> > A1 and A2 will run in that order, and (B1, B2) will be ordered, but
> you
> > can't control which set (A or B) runs first without horribly abusing
> the
> > phase bindings.  And, if you have a more complex sequence with 3
> plugins
> > and multiple executions of each, there aren't enough available
> phases to
> > successfully order everything.
> >
> > It should be possible to bind multiple plugin executions, of
> DIFFERENT
> > plugins, to a single phase and deterministically specify the
> execution
> > order.

Sorry, I disagree.  One alternative is to use antrun, but that seems like going backwards.  I'm really curious why there's a strong philosophical objection to requesting this enhancement.  

Is it unreasonable to suggest that "The Maven Way" is not perfect and might need some adjustments to handle common use-cases the original designers didn't foresee?

Is my goal of using Maven to automate CI/CD, which can involve configuring external resources by running various plugins in a specific sequence, somehow in violation of "the Maven way"?  

Consider the phrase "...you have wandered off The Maven Way™".  I can't tell if you intended this ironically or seriously.  If it's the latter, it seems like you're saying is "Maven is perfect. If Maven doesn't handle your use-case, then your use-case is invalid".  Is that true?

Re: Controlling order of plugin execution

Posted by Stephen Connolly <st...@gmail.com>.
Yes they forged a new path through the wilderness... And now we have
another Maven Way!

(Bonus points for making it independent of maven so that you are not tied
to us - if you love someone set them free... If they don't come back it was
not to be... Same goes for how maven should feel towards its users ;-) )

On Wednesday, 4 June 2014, Paul Benedict <pb...@apache.org> wrote:

> I don't think this existed when I first tried with Maven (my example was
> from many moons ago), but this is another tool in my toolbox now. Thank
> you! :-)
>
>
> Cheers,
> Paul
>
>
> On Wed, Jun 4, 2014 at 3:19 PM, Stephen Connolly <
> stephen.alan.connolly@gmail.com <javascript:;>> wrote:
>
> > On Wednesday, 4 June 2014, Paul Benedict <pbenedict@apache.org
> <javascript:;>> wrote:
> >
> > > I, myself, have also found the lack of ordered plugin execution to be
> > > wanting. Stephen does have a point: complex behavior is likely be
> better
> > > encapsulated in a new plugin. I don't disagree, but that route can be
> > steep
> > > and I don't want to be detoured into always writing a new plugin. Many
> > > times such behavior can be emulated simply by aggregating the use of
> > > plugins in an ordered fashion. For example, one plugin executes a SQL
> > > script to setup a database, the next plugin executes a Java program to
> > > populate the database according to logic.
> >
> >
> > Ahem  http://flywaydb.org
> >
> > I've tried that before and can't
> > > because such plugin ordering doesn't exist. So if there is an easy way
> to
> > > bring this minor enhancement to the Maven community, in 3.x, I think we
> > > should.
> > >
> > >
> > > Cheers,
> > > Paul
> > >
> > >
> > > On Wed, Jun 4, 2014 at 3:08 PM, Ron Wheeler <
> > > rwheeler@artifact-software.com <javascript:;> <javascript:;>>
> > > wrote:
> > >
> > > > "We are not a cult."
> > > > If we already have a "we", we are half way there!
> > > > Just short a charismatic leader and a "Book of the Way".
> > > >
> > > > Ron
> > > >
> > > > On 04/06/2014 3:22 PM, Jason van Zyl wrote:
> > > >
> > > >> On Jun 4, 2014, at 12:07 PM, Stephen Connolly <
> > > >> stephen.alan.connolly@gmail.com <javascript:;> <javascript:;>>
> wrote:
> > > >>
> > > >>  That's usually a sign that you have wandered off The Maven Way™
> > > >>>
> > > >>>  No it's not. They have valid points and the implementation is
> > > deficient
> > > >> in this regard. Everything that's presently here is not immutable.
> > > Calling
> > > >> it "The Maven Way" doesn't make it usable or without flaws. I'm not
> > even
> > > >> sure where this saying came from but we're not a cult.
> > > >>
> > > >>  There are ways back onto the blessed path... they typically involve
> > > >>> writing
> > > >>> a plugin
> > > >>>
> > > >>>  Thanks,
> > > >>
> > > >> Jason
> > > >>
> > > >> ----------------------------------------------------------
> > > >> Jason van Zyl
> > > >> Founder,  Apache Maven
> > > >> http://twitter.com/jvanzyl
> > > >> http://twitter.com/takari_io
> > > >> ---------------------------------------------------------
> > > >>
> > > >> I never make the mistake of arguing with people for whose opinions I
> > > have
> > > >> no respect.
> > > >>
> > > >> -- Edward Gibbon
> > > >>
> > > >>
> > > >>
> > > >>
> > > >>
> > > >>
> > > >>
> > > >>
> > > >>
> > > >>
> > > >>
> > > >
> > > > --
> > > > Ron Wheeler
> > > > President
> > > > Artifact Software Inc
> > > > email: rwheeler@artifact-software.com <javascript:;> <javascript:;>
> > > > skype: ronaldmwheeler
> > > > phone: 866-970-2435, ext 102
> > > >
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> <javascript:;>
> > > <javascript:;>
> > > > For additional commands, e-mail: users-help@maven.apache.org
> <javascript:;>
> > > <javascript:;>
> > > >
> > > >
> > >
> >
> >
> > --
> > Sent from my phone
> >
>


-- 
Sent from my phone

Re: Controlling order of plugin execution

Posted by Paul Benedict <pb...@apache.org>.
I don't think this existed when I first tried with Maven (my example was
from many moons ago), but this is another tool in my toolbox now. Thank
you! :-)


Cheers,
Paul


On Wed, Jun 4, 2014 at 3:19 PM, Stephen Connolly <
stephen.alan.connolly@gmail.com> wrote:

> On Wednesday, 4 June 2014, Paul Benedict <pb...@apache.org> wrote:
>
> > I, myself, have also found the lack of ordered plugin execution to be
> > wanting. Stephen does have a point: complex behavior is likely be better
> > encapsulated in a new plugin. I don't disagree, but that route can be
> steep
> > and I don't want to be detoured into always writing a new plugin. Many
> > times such behavior can be emulated simply by aggregating the use of
> > plugins in an ordered fashion. For example, one plugin executes a SQL
> > script to setup a database, the next plugin executes a Java program to
> > populate the database according to logic.
>
>
> Ahem  http://flywaydb.org
>
> I've tried that before and can't
> > because such plugin ordering doesn't exist. So if there is an easy way to
> > bring this minor enhancement to the Maven community, in 3.x, I think we
> > should.
> >
> >
> > Cheers,
> > Paul
> >
> >
> > On Wed, Jun 4, 2014 at 3:08 PM, Ron Wheeler <
> > rwheeler@artifact-software.com <javascript:;>>
> > wrote:
> >
> > > "We are not a cult."
> > > If we already have a "we", we are half way there!
> > > Just short a charismatic leader and a "Book of the Way".
> > >
> > > Ron
> > >
> > > On 04/06/2014 3:22 PM, Jason van Zyl wrote:
> > >
> > >> On Jun 4, 2014, at 12:07 PM, Stephen Connolly <
> > >> stephen.alan.connolly@gmail.com <javascript:;>> wrote:
> > >>
> > >>  That's usually a sign that you have wandered off The Maven Way™
> > >>>
> > >>>  No it's not. They have valid points and the implementation is
> > deficient
> > >> in this regard. Everything that's presently here is not immutable.
> > Calling
> > >> it "The Maven Way" doesn't make it usable or without flaws. I'm not
> even
> > >> sure where this saying came from but we're not a cult.
> > >>
> > >>  There are ways back onto the blessed path... they typically involve
> > >>> writing
> > >>> a plugin
> > >>>
> > >>>  Thanks,
> > >>
> > >> Jason
> > >>
> > >> ----------------------------------------------------------
> > >> Jason van Zyl
> > >> Founder,  Apache Maven
> > >> http://twitter.com/jvanzyl
> > >> http://twitter.com/takari_io
> > >> ---------------------------------------------------------
> > >>
> > >> I never make the mistake of arguing with people for whose opinions I
> > have
> > >> no respect.
> > >>
> > >> -- Edward Gibbon
> > >>
> > >>
> > >>
> > >>
> > >>
> > >>
> > >>
> > >>
> > >>
> > >>
> > >>
> > >
> > > --
> > > Ron Wheeler
> > > President
> > > Artifact Software Inc
> > > email: rwheeler@artifact-software.com <javascript:;>
> > > skype: ronaldmwheeler
> > > phone: 866-970-2435, ext 102
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > <javascript:;>
> > > For additional commands, e-mail: users-help@maven.apache.org
> > <javascript:;>
> > >
> > >
> >
>
>
> --
> Sent from my phone
>

Re: Controlling order of plugin execution

Posted by Stephen Connolly <st...@gmail.com>.
On Wednesday, 4 June 2014, Paul Benedict <pb...@apache.org> wrote:

> I, myself, have also found the lack of ordered plugin execution to be
> wanting. Stephen does have a point: complex behavior is likely be better
> encapsulated in a new plugin. I don't disagree, but that route can be steep
> and I don't want to be detoured into always writing a new plugin. Many
> times such behavior can be emulated simply by aggregating the use of
> plugins in an ordered fashion. For example, one plugin executes a SQL
> script to setup a database, the next plugin executes a Java program to
> populate the database according to logic.


Ahem  http://flywaydb.org

I've tried that before and can't
> because such plugin ordering doesn't exist. So if there is an easy way to
> bring this minor enhancement to the Maven community, in 3.x, I think we
> should.
>
>
> Cheers,
> Paul
>
>
> On Wed, Jun 4, 2014 at 3:08 PM, Ron Wheeler <
> rwheeler@artifact-software.com <javascript:;>>
> wrote:
>
> > "We are not a cult."
> > If we already have a "we", we are half way there!
> > Just short a charismatic leader and a "Book of the Way".
> >
> > Ron
> >
> > On 04/06/2014 3:22 PM, Jason van Zyl wrote:
> >
> >> On Jun 4, 2014, at 12:07 PM, Stephen Connolly <
> >> stephen.alan.connolly@gmail.com <javascript:;>> wrote:
> >>
> >>  That's usually a sign that you have wandered off The Maven Way™
> >>>
> >>>  No it's not. They have valid points and the implementation is
> deficient
> >> in this regard. Everything that's presently here is not immutable.
> Calling
> >> it "The Maven Way" doesn't make it usable or without flaws. I'm not even
> >> sure where this saying came from but we're not a cult.
> >>
> >>  There are ways back onto the blessed path... they typically involve
> >>> writing
> >>> a plugin
> >>>
> >>>  Thanks,
> >>
> >> Jason
> >>
> >> ----------------------------------------------------------
> >> Jason van Zyl
> >> Founder,  Apache Maven
> >> http://twitter.com/jvanzyl
> >> http://twitter.com/takari_io
> >> ---------------------------------------------------------
> >>
> >> I never make the mistake of arguing with people for whose opinions I
> have
> >> no respect.
> >>
> >> -- Edward Gibbon
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >
> > --
> > Ron Wheeler
> > President
> > Artifact Software Inc
> > email: rwheeler@artifact-software.com <javascript:;>
> > skype: ronaldmwheeler
> > phone: 866-970-2435, ext 102
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> <javascript:;>
> > For additional commands, e-mail: users-help@maven.apache.org
> <javascript:;>
> >
> >
>


-- 
Sent from my phone

Re: Controlling order of plugin execution

Posted by Paul Benedict <pb...@apache.org>.
I, myself, have also found the lack of ordered plugin execution to be
wanting. Stephen does have a point: complex behavior is likely be better
encapsulated in a new plugin. I don't disagree, but that route can be steep
and I don't want to be detoured into always writing a new plugin. Many
times such behavior can be emulated simply by aggregating the use of
plugins in an ordered fashion. For example, one plugin executes a SQL
script to setup a database, the next plugin executes a Java program to
populate the database according to logic. I've tried that before and can't
because such plugin ordering doesn't exist. So if there is an easy way to
bring this minor enhancement to the Maven community, in 3.x, I think we
should.


Cheers,
Paul


On Wed, Jun 4, 2014 at 3:08 PM, Ron Wheeler <rw...@artifact-software.com>
wrote:

> "We are not a cult."
> If we already have a "we", we are half way there!
> Just short a charismatic leader and a "Book of the Way".
>
> Ron
>
> On 04/06/2014 3:22 PM, Jason van Zyl wrote:
>
>> On Jun 4, 2014, at 12:07 PM, Stephen Connolly <
>> stephen.alan.connolly@gmail.com> wrote:
>>
>>  That's usually a sign that you have wandered off The Maven Way™
>>>
>>>  No it's not. They have valid points and the implementation is deficient
>> in this regard. Everything that's presently here is not immutable. Calling
>> it "The Maven Way" doesn't make it usable or without flaws. I'm not even
>> sure where this saying came from but we're not a cult.
>>
>>  There are ways back onto the blessed path... they typically involve
>>> writing
>>> a plugin
>>>
>>>  Thanks,
>>
>> Jason
>>
>> ----------------------------------------------------------
>> Jason van Zyl
>> Founder,  Apache Maven
>> http://twitter.com/jvanzyl
>> http://twitter.com/takari_io
>> ---------------------------------------------------------
>>
>> I never make the mistake of arguing with people for whose opinions I have
>> no respect.
>>
>> -- Edward Gibbon
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>
> --
> Ron Wheeler
> President
> Artifact Software Inc
> email: rwheeler@artifact-software.com
> skype: ronaldmwheeler
> phone: 866-970-2435, ext 102
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: Controlling order of plugin execution

Posted by Ron Wheeler <rw...@artifact-software.com>.
"We are not a cult."
If we already have a "we", we are half way there!
Just short a charismatic leader and a "Book of the Way".

Ron

On 04/06/2014 3:22 PM, Jason van Zyl wrote:
> On Jun 4, 2014, at 12:07 PM, Stephen Connolly <st...@gmail.com> wrote:
>
>> That's usually a sign that you have wandered off The Maven Way™
>>
> No it's not. They have valid points and the implementation is deficient in this regard. Everything that's presently here is not immutable. Calling it "The Maven Way" doesn't make it usable or without flaws. I'm not even sure where this saying came from but we're not a cult.
>
>> There are ways back onto the blessed path... they typically involve writing
>> a plugin
>>
> Thanks,
>
> Jason
>
> ----------------------------------------------------------
> Jason van Zyl
> Founder,  Apache Maven
> http://twitter.com/jvanzyl
> http://twitter.com/takari_io
> ---------------------------------------------------------
>
> I never make the mistake of arguing with people for whose opinions I have no respect.
>
> -- Edward Gibbon
>
>
>
>
>
>
>
>
>
>


-- 
Ron Wheeler
President
Artifact Software Inc
email: rwheeler@artifact-software.com
skype: ronaldmwheeler
phone: 866-970-2435, ext 102


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Controlling order of plugin execution

Posted by Stephen Connolly <st...@gmail.com>.
On Wednesday, 4 June 2014, Jason van Zyl <ja...@takari.io> wrote:

> On Jun 4, 2014, at 12:07 PM, Stephen Connolly <
> stephen.alan.connolly@gmail.com <javascript:;>> wrote:
>
> > That's usually a sign that you have wandered off The Maven Way™
> >
>
> No it's not. They have valid points and the implementation is deficient in
> this regard. Everything that's presently here is not immutable. Calling it
> "The Maven Way" doesn't make it usable or without flaws. I'm not even sure
> where this saying came from but we're not a cult.


I use the term "The Maven Way" to mean "the established best practice way
to build an XYZ"...

So when I say you have wandered off the Maven way, I mean that you are
encountering fractions because of your choice.

Why have you wandered off the conventional path? Probably because it does
not fit your needs.

If this is a once off, never to be repeated, thing... Well you can live
with the hacks you use to make it work...

Otherwise a new plugin with the required packaging type and a mojo to do
the "complex thing" in one single step is a much better solution...

And now in doing that you have forged a new Maven way... If you contribute
that way back to the community then our community grows richer because of
your efforts forging a new oath through the wild jungle.

There are four or five paths established and maintained by the maven
project:

* simple jar
* simple war
* simple ear
* simple ejb-jar
* simple rar

Are our paths perfect? Nope... For one our war path is not well adapted to
modern web application development... But it is still unclear the best path
to follow for modern war artifacts... I have an open experiment (jszip.org)
there's the webjars effort, etc

Somebody will find a *great path* for modern war files... Then if they can
get that into a packaging (bonus if the maven-war-plugin) the community can
all rejoice in the simplified new path and our poms can return to just
listing dependencies


> > There are ways back onto the blessed path... they typically involve
> writing
> > a plugin
> >
>
> Thanks,
>
> Jason
>
> ----------------------------------------------------------
> Jason van Zyl
> Founder,  Apache Maven
> http://twitter.com/jvanzyl
> http://twitter.com/takari_io
> ---------------------------------------------------------
>
> I never make the mistake of arguing with people for whose opinions I have
> no respect.
>
> -- Edward Gibbon
>
>
>
>
>
>
>
>
>
>

-- 
Sent from my phone

Re: Controlling order of plugin execution

Posted by Jason van Zyl <ja...@takari.io>.
On Jun 4, 2014, at 12:07 PM, Stephen Connolly <st...@gmail.com> wrote:

> That's usually a sign that you have wandered off The Maven Way™
> 

No it's not. They have valid points and the implementation is deficient in this regard. Everything that's presently here is not immutable. Calling it "The Maven Way" doesn't make it usable or without flaws. I'm not even sure where this saying came from but we're not a cult.

> There are ways back onto the blessed path... they typically involve writing
> a plugin
> 

Thanks,

Jason

----------------------------------------------------------
Jason van Zyl
Founder,  Apache Maven
http://twitter.com/jvanzyl
http://twitter.com/takari_io
---------------------------------------------------------

I never make the mistake of arguing with people for whose opinions I have no respect.

-- Edward Gibbon










Re: Controlling order of plugin execution

Posted by Stephen Connolly <st...@gmail.com>.
That's usually a sign that you have wandered off The Maven Way™

There are ways back onto the blessed path... they typically involve writing
a plugin


On 4 June 2014 16:47, jhgnwea <ji...@nwea.org> wrote:

> Paul Benedict wrote
> > I agree with Dan. Last I check, IIRC, the order of operations of plugins
> > is
> > defined by their sequential order in the POM. However, I also find this a
> > bit problematic with inheritance -- I don't know off the top of my head
> > what happens then.
>
> Ordering applies only for executions of a single plugin.  If you need to
> interleave executions of two or more plugins you're out of luck.  Say you
> have two plugins, exec-maven and maven-sql, and want to run
>
>     exec-maven A1
>     maven-sql B1
>     exec-maven A2
>     maven-sql B2
>
> A1 and A2 will run in that order, and (B1, B2) will be ordered, but you
> can't control which set (A or B) runs first without horribly abusing the
> phase bindings.  And, if you have a more complex sequence with 3  plugins
> and multiple executions of each, there aren't enough available phases to
> successfully order everything.
>
> It should be possible to bind multiple plugin executions, of DIFFERENT
> plugins, to a single phase and deterministically specify the execution
> order.
>
>
>
> --
> View this message in context:
> http://maven.40175.n5.nabble.com/Controlling-order-of-plugin-execution-tp5794777p5794892.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: Controlling order of plugin execution

Posted by jhgnwea <ji...@nwea.org>.
Paul Benedict wrote
> I agree with Dan. Last I check, IIRC, the order of operations of plugins
> is
> defined by their sequential order in the POM. However, I also find this a
> bit problematic with inheritance -- I don't know off the top of my head
> what happens then.

Ordering applies only for executions of a single plugin.  If you need to
interleave executions of two or more plugins you're out of luck.  Say you
have two plugins, exec-maven and maven-sql, and want to run 

    exec-maven A1
    maven-sql B1
    exec-maven A2
    maven-sql B2

A1 and A2 will run in that order, and (B1, B2) will be ordered, but you
can't control which set (A or B) runs first without horribly abusing the
phase bindings.  And, if you have a more complex sequence with 3  plugins
and multiple executions of each, there aren't enough available phases to
successfully order everything.

It should be possible to bind multiple plugin executions, of DIFFERENT
plugins, to a single phase and deterministically specify the execution
order.



--
View this message in context: http://maven.40175.n5.nabble.com/Controlling-order-of-plugin-execution-tp5794777p5794892.html
Sent from the Maven - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Controlling order of plugin execution

Posted by Paul Benedict <pb...@apache.org>.
I agree with Dan. Last I check, IIRC, the order of operations of plugins is
defined by their sequential order in the POM. However, I also find this a
bit problematic with inheritance -- I don't know off the top of my head
what happens then.


Cheers,
Paul


On Tue, Jun 3, 2014 at 3:01 PM, Dan Tran <da...@gmail.com> wrote:

> Agree sequencing is a pain.  You may be able to get this working if you
> move your sql plugin delaration below exec-m-p
>
> -D
>
>
> On Tue, Jun 3, 2014 at 12:54 PM, Paul Benedict <pb...@apache.org>
> wrote:
>
> > Jim, I reopened the issue for you, but, please note, this was closed
> > because the issue was created 6 years ago and no one ever submitted a
> > patch. Hopefully, someone has the incentive to work on this or it will be
> > closed again. If you find this feature critical to your own work, do you
> > have time to take a detour and submit a patch?
> >
> >
> > Cheers,
> > Paul
> >
> >
> > On Tue, Jun 3, 2014 at 2:48 PM, Jim Garrison <ji...@nwea.org>
> > wrote:
> >
> > > I'm trying to set up a Maven build for CI/CD, and one of the
> requirements
> > > for testing is to create, populate and tweak a database schema.
> > >
> > > This involves interleaving various executions of
> maven-dependency-plugin,
> > > sql-maven-plugin and exec-maven-plugin, and there aren't enough
> lifecycle
> > > phases *-test-[re]sources to accommodate all the steps.
> > >
> > > I'd like to bind six executions as follows:
> > >
> > >     1 maven-dependency-plugin:unpack -> generate-test-resources
> > >     2 sql-maven-plugin:execute       -> generate-test-resources
> > >     3 sql-maven-plugin:execute       -> generate-test-resources
> > >     4 exec-maven-plugin:exec         -> process-test-resources
> > >     5 exec-maven-plugin:exec         -> process-test-resources
> > >     6 sql-maven-plugin:execute       -> process-test-resources
> > >
> > > But this doesn't work as Maven wants to execute sql-maven-plugin
> (steps 2
> > > & 3) before step 1 and I can't find a way to make it do things in the
> > > desired sequence.
> > >
> > > There's a bug in Jira for this
> http://jira.codehaus.org/browse/MNG-3522
> > > but it was closed as part of the "great Jira cleanup of 2014".
> > >
> > > This has been an issue for several years but seems to get no attention.
> >  I
> > > don't think I should be required to write my own plugin to do what
> should
> > > be a common requirement.
> > >
> > > Can someone explain if there's an approved way to accomplish this?
> > >
> > > I know Maven is supposed to be declarative in nature, but sequencing
> > steps
> > > seems like a basic requirement.  From the lack of attention, and from
> > > reading other posts in places like StackOverflow, it appears there may
> > be a
> > > philosophical objection to explicitly ordering executions.  Can someone
> > > explain the reasoning for this?
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > > For additional commands, e-mail: users-help@maven.apache.org
> > >
> > >
> >
>

Re: Controlling order of plugin execution

Posted by Dan Tran <da...@gmail.com>.
Agree sequencing is a pain.  You may be able to get this working if you
move your sql plugin delaration below exec-m-p

-D


On Tue, Jun 3, 2014 at 12:54 PM, Paul Benedict <pb...@apache.org> wrote:

> Jim, I reopened the issue for you, but, please note, this was closed
> because the issue was created 6 years ago and no one ever submitted a
> patch. Hopefully, someone has the incentive to work on this or it will be
> closed again. If you find this feature critical to your own work, do you
> have time to take a detour and submit a patch?
>
>
> Cheers,
> Paul
>
>
> On Tue, Jun 3, 2014 at 2:48 PM, Jim Garrison <ji...@nwea.org>
> wrote:
>
> > I'm trying to set up a Maven build for CI/CD, and one of the requirements
> > for testing is to create, populate and tweak a database schema.
> >
> > This involves interleaving various executions of maven-dependency-plugin,
> > sql-maven-plugin and exec-maven-plugin, and there aren't enough lifecycle
> > phases *-test-[re]sources to accommodate all the steps.
> >
> > I'd like to bind six executions as follows:
> >
> >     1 maven-dependency-plugin:unpack -> generate-test-resources
> >     2 sql-maven-plugin:execute       -> generate-test-resources
> >     3 sql-maven-plugin:execute       -> generate-test-resources
> >     4 exec-maven-plugin:exec         -> process-test-resources
> >     5 exec-maven-plugin:exec         -> process-test-resources
> >     6 sql-maven-plugin:execute       -> process-test-resources
> >
> > But this doesn't work as Maven wants to execute sql-maven-plugin (steps 2
> > & 3) before step 1 and I can't find a way to make it do things in the
> > desired sequence.
> >
> > There's a bug in Jira for this http://jira.codehaus.org/browse/MNG-3522
> > but it was closed as part of the "great Jira cleanup of 2014".
> >
> > This has been an issue for several years but seems to get no attention.
>  I
> > don't think I should be required to write my own plugin to do what should
> > be a common requirement.
> >
> > Can someone explain if there's an approved way to accomplish this?
> >
> > I know Maven is supposed to be declarative in nature, but sequencing
> steps
> > seems like a basic requirement.  From the lack of attention, and from
> > reading other posts in places like StackOverflow, it appears there may
> be a
> > philosophical objection to explicitly ordering executions.  Can someone
> > explain the reasoning for this?
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
>

Re: Controlling order of plugin execution

Posted by Paul Benedict <pb...@apache.org>.
Jim, I reopened the issue for you, but, please note, this was closed
because the issue was created 6 years ago and no one ever submitted a
patch. Hopefully, someone has the incentive to work on this or it will be
closed again. If you find this feature critical to your own work, do you
have time to take a detour and submit a patch?


Cheers,
Paul


On Tue, Jun 3, 2014 at 2:48 PM, Jim Garrison <ji...@nwea.org> wrote:

> I'm trying to set up a Maven build for CI/CD, and one of the requirements
> for testing is to create, populate and tweak a database schema.
>
> This involves interleaving various executions of maven-dependency-plugin,
> sql-maven-plugin and exec-maven-plugin, and there aren't enough lifecycle
> phases *-test-[re]sources to accommodate all the steps.
>
> I'd like to bind six executions as follows:
>
>     1 maven-dependency-plugin:unpack -> generate-test-resources
>     2 sql-maven-plugin:execute       -> generate-test-resources
>     3 sql-maven-plugin:execute       -> generate-test-resources
>     4 exec-maven-plugin:exec         -> process-test-resources
>     5 exec-maven-plugin:exec         -> process-test-resources
>     6 sql-maven-plugin:execute       -> process-test-resources
>
> But this doesn't work as Maven wants to execute sql-maven-plugin (steps 2
> & 3) before step 1 and I can't find a way to make it do things in the
> desired sequence.
>
> There's a bug in Jira for this http://jira.codehaus.org/browse/MNG-3522
> but it was closed as part of the "great Jira cleanup of 2014".
>
> This has been an issue for several years but seems to get no attention.  I
> don't think I should be required to write my own plugin to do what should
> be a common requirement.
>
> Can someone explain if there's an approved way to accomplish this?
>
> I know Maven is supposed to be declarative in nature, but sequencing steps
> seems like a basic requirement.  From the lack of attention, and from
> reading other posts in places like StackOverflow, it appears there may be a
> philosophical objection to explicitly ordering executions.  Can someone
> explain the reasoning for this?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>