You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Wim Deblauwe <wi...@gmail.com> on 2010/07/13 11:09:36 UTC
Running antrun plugin twice in same phase with another plugin in
between?
Hi,
I need to run the antrun plugin twice in the packaging phase. I found this
on the wiki:
http://docs.codehaus.org/display/MAVENUSER/MiniGuide-AntMultiPhase
However, it speaks of different lifecycle phases. I tried with the same
phase and that works, however, I need to run another plugin in between. Is
this possible?
I was hoping that all plugins' executions would be sorted by their id. That
way, i could use id's like 'step-1-do-something',
'step-2-do-something-else', to force a certain order of plugin execution.
regards,
Wim
Re: Re : Running antrun plugin twice in same phase with another
plugin in between?
Posted by Wim Deblauwe <wi...@gmail.com>.
Hi Julien,
yes, I tried that too and it does not work. task1 does not get executed :(
regards,
Wim
2010/7/13 Julien HENRY <he...@yahoo.fr>
> Hi,
>
> Have you tried the following configuration?
>
> <build>
> <plugins>
> <plugin>
> <artifactId>maven-antrun-plugin</artifactId>
> <executions>
> <execution>
> <id>task1</id>
> <phase>yourphase</phase>
> <configuration>
> <tasks>
> <!-- Some task -->
> </tasks>
> </configuration>
> <goals>
> <goal>run</goal>
> </goals>
> </execution>
> </executions>
> </plugin>
> <plugin>
> <artifactId>your middle plugin</artifactId>
> <executions>
> <execution>
> <id>task2</id>
> <phase>yourphase</phase>
> <configuration>
> ...
> </configuration>
> <goals>
> ...
> </goals>
> </execution>
> </executions>
> </plugin>
> <plugin>
> <artifactId>maven-antrun-plugin</artifactId>
> <executions>
> <execution>
> <id>task3</id>
> <phase>yourphase</phase>
> <configuration>
> <tasks>
> <!-- Some other task -->
> </tasks>
> </configuration>
> <goals>
> <goal>run</goal>
> </goals>
> </execution>
> </executions>
> </plugin>
> </plugins>
> </build>
> I have not tested so I'm not sure it will work.
>
> Regards,
>
> Julien
>
>
>
> ----- Message d'origine ----
> > De : Wim Deblauwe <wi...@gmail.com>
> > À : Maven Users List <us...@maven.apache.org>
> > Envoyé le : Mar 13 juillet 2010, 11h 09min 36s
> > Objet : Running antrun plugin twice in same phase with another plugin in
> >between?
> >
> > Hi,
> >
> > I need to run the antrun plugin twice in the packaging phase. I found
> this
> > on the wiki:
> > http://docs.codehaus.org/display/MAVENUSER/MiniGuide-AntMultiPhase
> >
> > However, it speaks of different lifecycle phases. I tried with the same
> > phase and that works, however, I need to run another plugin in between.
> Is
> > this possible?
> >
> > I was hoping that all plugins' executions would be sorted by their id.
> That
> > way, i could use id's like 'step-1-do-something',
> > 'step-2-do-something-else', to force a certain order of plugin
> execution.
> >
> > regards,
> >
> > Wim
> >
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
Re : Running antrun plugin twice in same phase with another plugin in between?
Posted by Julien HENRY <he...@yahoo.fr>.
Hi,
Have you tried the following configuration?
<build>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>task1</id>
<phase>yourphase</phase>
<configuration>
<tasks>
<!-- Some task -->
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>your middle plugin</artifactId>
<executions>
<execution>
<id>task2</id>
<phase>yourphase</phase>
<configuration>
...
</configuration>
<goals>
...
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>task3</id>
<phase>yourphase</phase>
<configuration>
<tasks>
<!-- Some other task -->
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
I have not tested so I'm not sure it will work.
Regards,
Julien
----- Message d'origine ----
> De : Wim Deblauwe <wi...@gmail.com>
> À : Maven Users List <us...@maven.apache.org>
> Envoyé le : Mar 13 juillet 2010, 11h 09min 36s
> Objet : Running antrun plugin twice in same phase with another plugin in
>between?
>
> Hi,
>
> I need to run the antrun plugin twice in the packaging phase. I found this
> on the wiki:
> http://docs.codehaus.org/display/MAVENUSER/MiniGuide-AntMultiPhase
>
> However, it speaks of different lifecycle phases. I tried with the same
> phase and that works, however, I need to run another plugin in between. Is
> this possible?
>
> I was hoping that all plugins' executions would be sorted by their id. That
> way, i could use id's like 'step-1-do-something',
> 'step-2-do-something-else', to force a certain order of plugin execution.
>
> regards,
>
> Wim
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Running antrun plugin twice in same phase with another plugin in
between?
Posted by Wim Deblauwe <wi...@gmail.com>.
I had a look at the maven 2.2.x code and I created a small patch that does
it. See http://jira.codehaus.org/browse/MNG-4727
All the patch does is sorting the 'MojoExecution' classes based on their id.
It is very few lines of code really.
It is a bit hackish as you need to use "step-" in your <id/> declaration,
but it works perfectly. I hope the maven devs will pick it up under some
form or another.
regards,
Wim
2010/7/13 Wayne Fay <wa...@gmail.com>
> > However, it speaks of different lifecycle phases. I tried with the same
> > phase and that works, however, I need to run another plugin in between.
> Is
> > this possible?
>
> You could:
> release the maven-antrun-plugin under your own artifactId, say
> wim-antrun-plugin
> then use (in order): m-antrun-p, plugin2, w-antrun-p in your pom
>
> But this seems like a lot of extra work to me.
>
> Wayne
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
Re: Running antrun plugin twice in same phase with another plugin in
between?
Posted by Wayne Fay <wa...@gmail.com>.
> However, it speaks of different lifecycle phases. I tried with the same
> phase and that works, however, I need to run another plugin in between. Is
> this possible?
You could:
release the maven-antrun-plugin under your own artifactId, say wim-antrun-plugin
then use (in order): m-antrun-p, plugin2, w-antrun-p in your pom
But this seems like a lot of extra work to me.
Wayne
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Running antrun plugin twice in same phase with another plugin
in between?
Posted by Justin Edelson <ju...@gmail.com>.
You can't do this.
On 7/13/10 5:09 AM, Wim Deblauwe wrote:
> Hi,
>
> I need to run the antrun plugin twice in the packaging phase. I found this
> on the wiki:
> http://docs.codehaus.org/display/MAVENUSER/MiniGuide-AntMultiPhase
>
> However, it speaks of different lifecycle phases. I tried with the same
> phase and that works, however, I need to run another plugin in between. Is
> this possible?
>
> I was hoping that all plugins' executions would be sorted by their id. That
> way, i could use id's like 'step-1-do-something',
> 'step-2-do-something-else', to force a certain order of plugin execution.
>
> regards,
>
> Wim
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Running antrun plugin twice in same phase with another plugin in
between?
Posted by Wim Deblauwe <wi...@gmail.com>.
That would mean I would have to call maven plugins from inside the maven
antrun plugin. Seems odd and no idea if that is even possible?
2010/7/15 Ron Wheeler <rw...@artifact-software.com>
> Can't you order the tasks inside Ant?
>
> Ron
>
> On 15/07/2010 2:31 AM, Wim Deblauwe wrote:
>
>> I do not think this really a big improvement. In my usecase, I need to do
>> 4
>> things in a defined order in the after-package, so you are just moving the
>> problem. A real ordering of plugin execution during the phases is what I
>> really need. I admit that I just recently had a need for it after using
>> Maven 2 for more then 2 years on various (big) projects, so it is rare I
>> think that you need it, but if you do, you *really* need it.
>>
>> 2010/7/14 Gorham-Engard, Frank<Fr...@cable.comcast.com>
>>
>> Hello users,
>>> I have an alternate suggestion to the phase/goal ordering issues that are
>>> often raised here.
>>> Allow for the specification of<phase> to include a 'before-' or 'after-'
>>> prefix.
>>> Users could specify the<phase> for a plugin execution to be, for
>>> example,
>>> 'before-deploy' or 'after-package'. This wouldn't break the life-cycle
>>> model
>>> while permitting a constrained method for expanding it.
>>> Also, any 'after-' phases should be executed when the phase is the
>>> target.
>>> For example, if I specified a plugin for 'after-deploy' it would be
>>> executed
>>> (at the end) when the command line was 'mvn deploy'.
>>> Perhaps even 'before-before-test' should be allowed as well? But not
>>> 'before-after-test', let's not go there!
>>>
>>> <!-- Frank Gorham-Engard →
>>> "Be kinder than necessary.
>>> Everyone you work with is fighting some kind of battle."
>>>
>>> -----Original Message-----
>>> From: Wim Deblauwe [mailto:wim.deblauwe@gmail.com]
>>> Sent: Tuesday, July 13, 2010 5:10 AM
>>> To: Maven Users List
>>> Subject: Running antrun plugin twice in same phase with another plugin in
>>> between?
>>>
>>> Hi,
>>>
>>> I need to run the antrun plugin twice in the packaging phase. I found
>>> this
>>> on the wiki:
>>> http://docs.codehaus.org/display/MAVENUSER/MiniGuide-AntMultiPhase
>>>
>>> However, it speaks of different lifecycle phases. I tried with the same
>>> phase and that works, however, I need to run another plugin in between.
>>> Is
>>> this possible?
>>>
>>> I was hoping that all plugins' executions would be sorted by their id.
>>> That
>>> way, i could use id's like 'step-1-do-something',
>>> 'step-2-do-something-else', to force a certain order of plugin execution.
>>>
>>> regards,
>>>
>>> Wim
>>>
>>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
Re: Running antrun plugin twice in same phase with another plugin
in between?
Posted by Ron Wheeler <rw...@artifact-software.com>.
Can't you order the tasks inside Ant?
Ron
On 15/07/2010 2:31 AM, Wim Deblauwe wrote:
> I do not think this really a big improvement. In my usecase, I need to do 4
> things in a defined order in the after-package, so you are just moving the
> problem. A real ordering of plugin execution during the phases is what I
> really need. I admit that I just recently had a need for it after using
> Maven 2 for more then 2 years on various (big) projects, so it is rare I
> think that you need it, but if you do, you *really* need it.
>
> 2010/7/14 Gorham-Engard, Frank<Fr...@cable.comcast.com>
>
>> Hello users,
>> I have an alternate suggestion to the phase/goal ordering issues that are
>> often raised here.
>> Allow for the specification of<phase> to include a 'before-' or 'after-'
>> prefix.
>> Users could specify the<phase> for a plugin execution to be, for example,
>> 'before-deploy' or 'after-package'. This wouldn't break the life-cycle model
>> while permitting a constrained method for expanding it.
>> Also, any 'after-' phases should be executed when the phase is the target.
>> For example, if I specified a plugin for 'after-deploy' it would be executed
>> (at the end) when the command line was 'mvn deploy'.
>> Perhaps even 'before-before-test' should be allowed as well? But not
>> 'before-after-test', let's not go there!
>>
>> <!-- Frank Gorham-Engard →
>> "Be kinder than necessary.
>> Everyone you work with is fighting some kind of battle."
>>
>> -----Original Message-----
>> From: Wim Deblauwe [mailto:wim.deblauwe@gmail.com]
>> Sent: Tuesday, July 13, 2010 5:10 AM
>> To: Maven Users List
>> Subject: Running antrun plugin twice in same phase with another plugin in
>> between?
>>
>> Hi,
>>
>> I need to run the antrun plugin twice in the packaging phase. I found this
>> on the wiki:
>> http://docs.codehaus.org/display/MAVENUSER/MiniGuide-AntMultiPhase
>>
>> However, it speaks of different lifecycle phases. I tried with the same
>> phase and that works, however, I need to run another plugin in between. Is
>> this possible?
>>
>> I was hoping that all plugins' executions would be sorted by their id. That
>> way, i could use id's like 'step-1-do-something',
>> 'step-2-do-something-else', to force a certain order of plugin execution.
>>
>> regards,
>>
>> Wim
>>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Running antrun plugin twice in same phase with another plugin in
between?
Posted by Wim Deblauwe <wi...@gmail.com>.
I do not think this really a big improvement. In my usecase, I need to do 4
things in a defined order in the after-package, so you are just moving the
problem. A real ordering of plugin execution during the phases is what I
really need. I admit that I just recently had a need for it after using
Maven 2 for more then 2 years on various (big) projects, so it is rare I
think that you need it, but if you do, you *really* need it.
2010/7/14 Gorham-Engard, Frank <Fr...@cable.comcast.com>
> Hello users,
> I have an alternate suggestion to the phase/goal ordering issues that are
> often raised here.
> Allow for the specification of <phase> to include a 'before-' or 'after-'
> prefix.
> Users could specify the <phase> for a plugin execution to be, for example,
> 'before-deploy' or 'after-package'. This wouldn't break the life-cycle model
> while permitting a constrained method for expanding it.
> Also, any 'after-' phases should be executed when the phase is the target.
> For example, if I specified a plugin for 'after-deploy' it would be executed
> (at the end) when the command line was 'mvn deploy'.
> Perhaps even 'before-before-test' should be allowed as well? But not
> 'before-after-test', let's not go there!
>
> <!-- Frank Gorham-Engard →
> "Be kinder than necessary.
> Everyone you work with is fighting some kind of battle."
>
> -----Original Message-----
> From: Wim Deblauwe [mailto:wim.deblauwe@gmail.com]
> Sent: Tuesday, July 13, 2010 5:10 AM
> To: Maven Users List
> Subject: Running antrun plugin twice in same phase with another plugin in
> between?
>
> Hi,
>
> I need to run the antrun plugin twice in the packaging phase. I found this
> on the wiki:
> http://docs.codehaus.org/display/MAVENUSER/MiniGuide-AntMultiPhase
>
> However, it speaks of different lifecycle phases. I tried with the same
> phase and that works, however, I need to run another plugin in between. Is
> this possible?
>
> I was hoping that all plugins' executions would be sorted by their id. That
> way, i could use id's like 'step-1-do-something',
> 'step-2-do-something-else', to force a certain order of plugin execution.
>
> regards,
>
> Wim
>
RE: Running antrun plugin twice in same phase with another plugin in between?
Posted by "Gorham-Engard, Frank" <Fr...@cable.comcast.com>.
Hello users,
I have an alternate suggestion to the phase/goal ordering issues that are often raised here.
Allow for the specification of <phase> to include a 'before-' or 'after-' prefix.
Users could specify the <phase> for a plugin execution to be, for example, 'before-deploy' or 'after-package'. This wouldn't break the life-cycle model while permitting a constrained method for expanding it.
Also, any 'after-' phases should be executed when the phase is the target. For example, if I specified a plugin for 'after-deploy' it would be executed (at the end) when the command line was 'mvn deploy'.
Perhaps even 'before-before-test' should be allowed as well? But not 'before-after-test', let's not go there!
<!-- Frank Gorham-Engard →
"Be kinder than necessary.
Everyone you work with is fighting some kind of battle."
-----Original Message-----
From: Wim Deblauwe [mailto:wim.deblauwe@gmail.com]
Sent: Tuesday, July 13, 2010 5:10 AM
To: Maven Users List
Subject: Running antrun plugin twice in same phase with another plugin in between?
Hi,
I need to run the antrun plugin twice in the packaging phase. I found this
on the wiki:
http://docs.codehaus.org/display/MAVENUSER/MiniGuide-AntMultiPhase
However, it speaks of different lifecycle phases. I tried with the same
phase and that works, however, I need to run another plugin in between. Is
this possible?
I was hoping that all plugins' executions would be sorted by their id. That
way, i could use id's like 'step-1-do-something',
'step-2-do-something-else', to force a certain order of plugin execution.
regards,
Wim