You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Justin Lee <ev...@gmail.com> on 2011/04/28 23:35:10 UTC

reordering the lifecycle

I have a huge tree of ant based projects i'm trying to convert to maven.  I
have the mechanics worked about except for a minor hitch:  I need the test
phase to be the last one executed.  Since all of this code is test code
there will be no artifacts to install, no deployments run.  But I need to,
say, generate the war files before surefire kicks off and runs the test.
 How can I do that?  Could I bind the surefire plugin to the install phase
instead?

Re: reordering the lifecycle

Posted by Justin Lee <ev...@gmail.com>.
That's what I ended up.  Thanks to whomever initially suggested that.  I'm
not even sure I knew that phase existed before that.

On Mon, May 2, 2011 at 7:51 PM, Benson Margulies <bi...@gmail.com>wrote:

> Bind surefire to the integration-test phase, that runs post-packaging.
>
> On Fri, Apr 29, 2011 at 3:05 AM, Ron Wheeler
> <rw...@artifact-software.com> wrote:
> > On 28/04/2011 5:35 PM, Justin Lee wrote:
> >>
> >> I have a huge tree of ant based projects i'm trying to convert to maven.
> >>  I
> >> have the mechanics worked about except for a minor hitch:  I need the
> test
> >> phase to be the last one executed.  Since all of this code is test code
> >> there will be no artifacts to install, no deployments run.  But I need
> to,
> >> say, generate the war files before surefire kicks off and runs the test.
> >>  How can I do that?  Could I bind the surefire plugin to the install
> phase
> >> instead?
> >>
> > Try to identify the "Maven way" to do what you are doing.
> > Maven is not Ant.
> >
> > Don't be tempted to invent something new unless you are sure that no one
> > else has ever tried to develop an application like yours.
> > There is a Maven Best Practice for almost every situation and most likely
> > thousands of people have already set up a project like yours. It
> somethings
> > takes a bit of digging to find out the "right" way.
> >
> >
> > Ron
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: reordering the lifecycle

Posted by Benson Margulies <bi...@gmail.com>.
Bind surefire to the integration-test phase, that runs post-packaging.

On Fri, Apr 29, 2011 at 3:05 AM, Ron Wheeler
<rw...@artifact-software.com> wrote:
> On 28/04/2011 5:35 PM, Justin Lee wrote:
>>
>> I have a huge tree of ant based projects i'm trying to convert to maven.
>>  I
>> have the mechanics worked about except for a minor hitch:  I need the test
>> phase to be the last one executed.  Since all of this code is test code
>> there will be no artifacts to install, no deployments run.  But I need to,
>> say, generate the war files before surefire kicks off and runs the test.
>>  How can I do that?  Could I bind the surefire plugin to the install phase
>> instead?
>>
> Try to identify the "Maven way" to do what you are doing.
> Maven is not Ant.
>
> Don't be tempted to invent something new unless you are sure that no one
> else has ever tried to develop an application like yours.
> There is a Maven Best Practice for almost every situation and most likely
> thousands of people have already set up a project like yours. It somethings
> takes a bit of digging to find out the "right" way.
>
>
> Ron
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

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


Re: reordering the lifecycle

Posted by Justin Lee <ev...@gmail.com>.
I understand and fully support The Maven Way.  But this is a tree of 500+
tests in this tree alone (there's at least another half dozen other trees)
I'm trying to script the conversion for.  There's a limit to how much I can
script reliably.  In this case the code being tested is built elsewhere.
 This tree generates artifacts (test wars and servlets, e.g.) that are
deployed and then used in testing.  But these artifacts and tests both live
in essentially the same maven module.  Yes, it's more than mildly crappy.
 Yes, there are betters ways to do this if you're starting from scratch.
 But this test code and the "framework" it's built on are 10+ years old in
some cases and far predate maven, testng, and junit.  I'm trying to bring
this code in to the 21st century bit by bit but I can only do so much at
once.  So for now, making the default goal "integration-test" is exactly
what I needed.

On Mon, May 2, 2011 at 6:08 PM, Ed Hillmann <ed...@gmail.com> wrote:

> On Fri, Apr 29, 2011 at 5:05 PM, Ron Wheeler <
> rwheeler@artifact-software.com
> > wrote:
>
> > On 28/04/2011 5:35 PM, Justin Lee wrote:
> >
> >> I have a huge tree of ant based projects i'm trying to convert to maven.
> >>  I
> >> have the mechanics worked about except for a minor hitch:  I need the
> test
> >> phase to be the last one executed.  Since all of this code is test code
> >> there will be no artifacts to install, no deployments run.  But I need
> to,
> >> say, generate the war files before surefire kicks off and runs the test.
> >>  How can I do that?  Could I bind the surefire plugin to the install
> phase
> >> instead?
> >>
> >>  Try to identify the "Maven way" to do what you are doing.
> > Maven is not Ant.
> >
> > Don't be tempted to invent something new unless you are sure that no one
> > else has ever tried to develop an application like yours.
> > There is a Maven Best Practice for almost every situation and most likely
> > thousands of people have already set up a project like yours. It
> somethings
> > takes a bit of digging to find out the "right" way.
> >
> >
> > Ron
> >
>
> Another option which I've found useful is separate the tests into a
> different module from the code being tested.  This is quite
> straight-forward, and you can use Maven dependencies to ensure the tests
> are
> running against the right version of the WAR file.  So, you'd have the
> original module that builds the WAR file (and whatever appropriate
> Unit-level tests remaining in this module... any tests that don't require a
> packaged and/or deployed WAR file), and a new module which contains only
> those tests that require the WAR file.  I do this with my Selenium tests.
>
> This is a nice Maven-way of doing it, ensuring I don't run my Selenium
> tests
> if the WAR doesn't build.
>
> Just another thought. :)
>
> Thanks,
> Ed
>

Re: reordering the lifecycle

Posted by Ed Hillmann <ed...@gmail.com>.
On Fri, Apr 29, 2011 at 5:05 PM, Ron Wheeler <rwheeler@artifact-software.com
> wrote:

> On 28/04/2011 5:35 PM, Justin Lee wrote:
>
>> I have a huge tree of ant based projects i'm trying to convert to maven.
>>  I
>> have the mechanics worked about except for a minor hitch:  I need the test
>> phase to be the last one executed.  Since all of this code is test code
>> there will be no artifacts to install, no deployments run.  But I need to,
>> say, generate the war files before surefire kicks off and runs the test.
>>  How can I do that?  Could I bind the surefire plugin to the install phase
>> instead?
>>
>>  Try to identify the "Maven way" to do what you are doing.
> Maven is not Ant.
>
> Don't be tempted to invent something new unless you are sure that no one
> else has ever tried to develop an application like yours.
> There is a Maven Best Practice for almost every situation and most likely
> thousands of people have already set up a project like yours. It somethings
> takes a bit of digging to find out the "right" way.
>
>
> Ron
>

Another option which I've found useful is separate the tests into a
different module from the code being tested.  This is quite
straight-forward, and you can use Maven dependencies to ensure the tests are
running against the right version of the WAR file.  So, you'd have the
original module that builds the WAR file (and whatever appropriate
Unit-level tests remaining in this module... any tests that don't require a
packaged and/or deployed WAR file), and a new module which contains only
those tests that require the WAR file.  I do this with my Selenium tests.

This is a nice Maven-way of doing it, ensuring I don't run my Selenium tests
if the WAR doesn't build.

Just another thought. :)

Thanks,
Ed

Re: reordering the lifecycle

Posted by Ron Wheeler <rw...@artifact-software.com>.
On 28/04/2011 5:35 PM, Justin Lee wrote:
> I have a huge tree of ant based projects i'm trying to convert to maven.  I
> have the mechanics worked about except for a minor hitch:  I need the test
> phase to be the last one executed.  Since all of this code is test code
> there will be no artifacts to install, no deployments run.  But I need to,
> say, generate the war files before surefire kicks off and runs the test.
>   How can I do that?  Could I bind the surefire plugin to the install phase
> instead?
>
Try to identify the "Maven way" to do what you are doing.
Maven is not Ant.

Don't be tempted to invent something new unless you are sure that no one 
else has ever tried to develop an application like yours.
There is a Maven Best Practice for almost every situation and most 
likely thousands of people have already set up a project like yours. It 
somethings takes a bit of digging to find out the "right" way.


Ron

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


Re: reordering the lifecycle

Posted by Justin Lee <ev...@gmail.com>.
google to the rescue!  found it.  thanks for the tip.

On Thu, Apr 28, 2011 at 6:32 PM, Justin Lee <ev...@gmail.com> wrote:

> I'd be all up for that.  How do I configure that?
>
>
> On Thu, Apr 28, 2011 at 6:02 PM, Ed Hillmann <ed...@gmail.com>wrote:
>
>> Wouldn't it be easier to use the integration-test phase instead of the
>> test
>> phase?  The integration-test phase runs after the package phase, and can
>> be
>> used to run tests later in the lifecycle.
>>
>> Just a thought,
>> Ed
>>
>> On Fri, Apr 29, 2011 at 7:35 AM, Justin Lee <ev...@gmail.com> wrote:
>>
>> > I have a huge tree of ant based projects i'm trying to convert to maven.
>>  I
>> > have the mechanics worked about except for a minor hitch:  I need the
>> test
>> > phase to be the last one executed.  Since all of this code is test code
>> > there will be no artifacts to install, no deployments run.  But I need
>> to,
>> > say, generate the war files before surefire kicks off and runs the test.
>> >  How can I do that?  Could I bind the surefire plugin to the install
>> phase
>> > instead?
>> >
>>
>
>

Re: reordering the lifecycle

Posted by Justin Lee <ev...@gmail.com>.
I'd be all up for that.  How do I configure that?


On Thu, Apr 28, 2011 at 6:02 PM, Ed Hillmann <ed...@gmail.com> wrote:

> Wouldn't it be easier to use the integration-test phase instead of the test
> phase?  The integration-test phase runs after the package phase, and can be
> used to run tests later in the lifecycle.
>
> Just a thought,
> Ed
>
> On Fri, Apr 29, 2011 at 7:35 AM, Justin Lee <ev...@gmail.com> wrote:
>
> > I have a huge tree of ant based projects i'm trying to convert to maven.
>  I
> > have the mechanics worked about except for a minor hitch:  I need the
> test
> > phase to be the last one executed.  Since all of this code is test code
> > there will be no artifacts to install, no deployments run.  But I need
> to,
> > say, generate the war files before surefire kicks off and runs the test.
> >  How can I do that?  Could I bind the surefire plugin to the install
> phase
> > instead?
> >
>

RE: reordering the lifecycle

Posted by Martin Gainty <mg...@hotmail.com>.
you can create a custom lifecycle which identifies the artifacts you wish to execute in \META-INF\maven\lifecycles.xml
http://www.sonatype.com/books/mvnref-book/reference/writing-plugins-sect-plugins-lifecycle.html

Martin Gainty 
______________________________________________ 
Jogi és Bizalmassági kinyilatkoztatás/Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
 Ez az
üzenet bizalmas.  Ha nem ön az akinek szánva volt, akkor kérjük, hogy
jelentse azt nekünk vissza. Semmiféle továbbítása vagy másolatának
készítése nem megengedett.  Ez az üzenet csak ismeret cserét szolgál és
semmiféle jogi alkalmazhatósága sincs.  Mivel az electronikus üzenetek
könnyen megváltoztathatóak, ezért minket semmi felelöség nem terhelhet
ezen üzenet tartalma miatt.

Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.




> Date: Fri, 29 Apr 2011 08:02:16 +1000
> Subject: Re: reordering the lifecycle
> From: ed.hillmann@gmail.com
> To: users@maven.apache.org
> 
> Wouldn't it be easier to use the integration-test phase instead of the test
> phase?  The integration-test phase runs after the package phase, and can be
> used to run tests later in the lifecycle.
> 
> Just a thought,
> Ed
> 
> On Fri, Apr 29, 2011 at 7:35 AM, Justin Lee <ev...@gmail.com> wrote:
> 
> > I have a huge tree of ant based projects i'm trying to convert to maven.  I
> > have the mechanics worked about except for a minor hitch:  I need the test
> > phase to be the last one executed.  Since all of this code is test code
> > there will be no artifacts to install, no deployments run.  But I need to,
> > say, generate the war files before surefire kicks off and runs the test.
> >  How can I do that?  Could I bind the surefire plugin to the install phase
> > instead?
> >
 		 	   		  

Re: reordering the lifecycle

Posted by Ed Hillmann <ed...@gmail.com>.
Wouldn't it be easier to use the integration-test phase instead of the test
phase?  The integration-test phase runs after the package phase, and can be
used to run tests later in the lifecycle.

Just a thought,
Ed

On Fri, Apr 29, 2011 at 7:35 AM, Justin Lee <ev...@gmail.com> wrote:

> I have a huge tree of ant based projects i'm trying to convert to maven.  I
> have the mechanics worked about except for a minor hitch:  I need the test
> phase to be the last one executed.  Since all of this code is test code
> there will be no artifacts to install, no deployments run.  But I need to,
> say, generate the war files before surefire kicks off and runs the test.
>  How can I do that?  Could I bind the surefire plugin to the install phase
> instead?
>