You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Andrei Ivanov <an...@gmail.com> on 2008/07/01 09:00:21 UTC

How to emulate the concept of an Ant target?

Hello,
I'm a Maven newbie and I'm having some difficulties understanding some
concepts, so I hope you can help me...
In an Ant build.xml, I could create a target in which I could call tasks:
<target name="targetA">
   <task1 />
   <task2 />
</target>

I've read about the lifecycle concepts of Maven, and I know that a
plugin has one or more goals and that I can create an execution and
specify which goal(s) to be attached to a certain phase.

My problem is that I don't want to use any of the existing lifcycles/phases.
I just want to call a sequence of goals of some plugins, grouped in a
target/goal(I saw that in Maven 1 custom goals could be defined in
maven.xml). These goals that I want to execute don't have anything to
do with packaging...

How can I do that?

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


Re: How to emulate the concept of an Ant target?

Posted by Stephen Connolly <st...@gmail.com>.
On Tue, Jul 1, 2008 at 9:07 AM, Andrei Ivanov <an...@gmail.com> wrote:
> On 7/1/08, Stephen Connolly <st...@gmail.com> wrote:
>> Option 1.
>>
>>  a shell script/batch file that just does
>>
>>     mvn plugin1:goalA plugin2:goalB plugin3:gaolC
>>
>>  This is especially handy if some of the goals should only be run on
>>  the local directory while others need to run throughout the tree, the
>>  script can invoke maven multiple times with and without the -N flag
>>
>>  Option 2.
>>
>>  a custom profile that binds everything you need to the validate
>>  phase... thus you just go
>>
>>      mvn -Pmytask validate
>>
>>  Downside: this is obviously a hack
>>
>>  Option 3.
>>
>>  write your own plugin that binds all the other plugins to phases as
>>  needed then you can do
>>
>>      mvn myplugin:do-it-all
>>
>>  This is what most people consider the "right way"
>>
>
> Thanks for the suggestions...
>
> <sarcasm>So.. this Maven thing is supposed to be better than Ant,
> right?</sarcasm>

It depends...

if you want a build tool that uses a single set of well known verbs to
perform well known steps in the build lifecycle... maven is for you

if you want to do anything you like in a straight at it no fuss kind
of way and you don't care about consistency with the rest of the world
(i.e. just because everyone else calls it "deploy" does not mean I
have to call it "deploy" i'm going to call it "push-wars" so that new
hires have to ask me how to deploy)... ant is for you

>
>>
>>  On Tue, Jul 1, 2008 at 8:00 AM, Andrei Ivanov <an...@gmail.com> wrote:
>>  > Hello,
>>  > I'm a Maven newbie and I'm having some difficulties understanding some
>>  > concepts, so I hope you can help me...
>>  > In an Ant build.xml, I could create a target in which I could call tasks:
>>  > <target name="targetA">
>>  >   <task1 />
>>  >   <task2 />
>>  > </target>
>>  >
>>  > I've read about the lifecycle concepts of Maven, and I know that a
>>  > plugin has one or more goals and that I can create an execution and
>>  > specify which goal(s) to be attached to a certain phase.
>>  >
>>  > My problem is that I don't want to use any of the existing lifcycles/phases.
>>  > I just want to call a sequence of goals of some plugins, grouped in a
>>  > target/goal(I saw that in Maven 1 custom goals could be defined in
>>  > maven.xml). These goals that I want to execute don't have anything to
>>  > do with packaging...
>>  >
>>  > How can I do that?
>
> ---------------------------------------------------------------------
> 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: How to emulate the concept of an Ant target?

Posted by Andrei Ivanov <an...@gmail.com>.
On 7/1/08, Stephen Connolly <st...@gmail.com> wrote:
> Option 1.
>
>  a shell script/batch file that just does
>
>     mvn plugin1:goalA plugin2:goalB plugin3:gaolC
>
>  This is especially handy if some of the goals should only be run on
>  the local directory while others need to run throughout the tree, the
>  script can invoke maven multiple times with and without the -N flag
>
>  Option 2.
>
>  a custom profile that binds everything you need to the validate
>  phase... thus you just go
>
>      mvn -Pmytask validate
>
>  Downside: this is obviously a hack
>
>  Option 3.
>
>  write your own plugin that binds all the other plugins to phases as
>  needed then you can do
>
>      mvn myplugin:do-it-all
>
>  This is what most people consider the "right way"
>

Thanks for the suggestions...

<sarcasm>So.. this Maven thing is supposed to be better than Ant,
right?</sarcasm>

>
>  On Tue, Jul 1, 2008 at 8:00 AM, Andrei Ivanov <an...@gmail.com> wrote:
>  > Hello,
>  > I'm a Maven newbie and I'm having some difficulties understanding some
>  > concepts, so I hope you can help me...
>  > In an Ant build.xml, I could create a target in which I could call tasks:
>  > <target name="targetA">
>  >   <task1 />
>  >   <task2 />
>  > </target>
>  >
>  > I've read about the lifecycle concepts of Maven, and I know that a
>  > plugin has one or more goals and that I can create an execution and
>  > specify which goal(s) to be attached to a certain phase.
>  >
>  > My problem is that I don't want to use any of the existing lifcycles/phases.
>  > I just want to call a sequence of goals of some plugins, grouped in a
>  > target/goal(I saw that in Maven 1 custom goals could be defined in
>  > maven.xml). These goals that I want to execute don't have anything to
>  > do with packaging...
>  >
>  > How can I do that?

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


Re: How to emulate the concept of an Ant target?

Posted by Stephen Connolly <st...@gmail.com>.
Option 1.

a shell script/batch file that just does

    mvn plugin1:goalA plugin2:goalB plugin3:gaolC

This is especially handy if some of the goals should only be run on
the local directory while others need to run throughout the tree, the
script can invoke maven multiple times with and without the -N flag

Option 2.

a custom profile that binds everything you need to the validate
phase... thus you just go

     mvn -Pmytask validate

Downside: this is obviously a hack

Option 3.

write your own plugin that binds all the other plugins to phases as
needed then you can do

     mvn myplugin:do-it-all

This is what most people consider the "right way"

On Tue, Jul 1, 2008 at 8:00 AM, Andrei Ivanov <an...@gmail.com> wrote:
> Hello,
> I'm a Maven newbie and I'm having some difficulties understanding some
> concepts, so I hope you can help me...
> In an Ant build.xml, I could create a target in which I could call tasks:
> <target name="targetA">
>   <task1 />
>   <task2 />
> </target>
>
> I've read about the lifecycle concepts of Maven, and I know that a
> plugin has one or more goals and that I can create an execution and
> specify which goal(s) to be attached to a certain phase.
>
> My problem is that I don't want to use any of the existing lifcycles/phases.
> I just want to call a sequence of goals of some plugins, grouped in a
> target/goal(I saw that in Maven 1 custom goals could be defined in
> maven.xml). These goals that I want to execute don't have anything to
> do with packaging...
>
> How can I do that?
>
> ---------------------------------------------------------------------
> 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