You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Chris Hagmann <ch...@yahoo.com> on 2006/03/16 07:11:44 UTC

[m2] How to configure maven-antrun plugin without binding to a lifecycle phase

We need to execute some ANT tasks (e.g. for
redeploying a server configuration) which we only need
to execute every so often, but which are not part of
the regular build lifecycle. Hence we need to
configure the plugin, but cannot bind it to any of the
lifecycle phases of Maven 2. 

How can we do that?

Thanks,
Chris

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


Re: [m2] How to configure maven-antrun plugin without binding to a lifecycle phase

Posted by ha...@yahoo.com.
This doesn't work unfortunately as the deployment is a
little more complex. We need to get some information
(e.g. artifact version) to make the deployment work,
and we don't want to duplicate that info outside the
POM. So, if we invoke ANT directly, we simply don't
have that info.

Thanks anyways.

--- Wayne Fay <wa...@gmail.com> wrote:

> I'd leave it in Ant, and call it directly, not via
> antrun/maven.
> That's how I'm deploying our j2ee app currently...
> Just plain old "ant
> <target>".
> 
> ;-)
> 
> Wayne
> 
> 
> On 3/16/06, Chris Hagmann <ch...@yahoo.com>
> wrote:
> > We need to execute some ANT tasks (e.g. for
> > redeploying a server configuration) which we only
> need
> > to execute every so often, but which are not part
> of
> > the regular build lifecycle. Hence we need to
> > configure the plugin, but cannot bind it to any of
> the
> > lifecycle phases of Maven 2.
> >
> > How can we do that?
> >
> > Thanks,
> > Chris
> >
> >
>
---------------------------------------------------------------------
> > 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: [m2] How to configure maven-antrun plugin without binding to a lifecycle phase

Posted by Wayne Fay <wa...@gmail.com>.
I'd leave it in Ant, and call it directly, not via antrun/maven.
That's how I'm deploying our j2ee app currently... Just plain old "ant
<target>".

;-)

Wayne


On 3/16/06, Chris Hagmann <ch...@yahoo.com> wrote:
> We need to execute some ANT tasks (e.g. for
> redeploying a server configuration) which we only need
> to execute every so often, but which are not part of
> the regular build lifecycle. Hence we need to
> configure the plugin, but cannot bind it to any of the
> lifecycle phases of Maven 2.
>
> How can we do that?
>
> Thanks,
> Chris
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: [m2] How to configure maven-antrun plugin without binding to a lifecycle phase

Posted by ha...@yahoo.com.
Dan,

That's actually a great idea. Let me try that, but
that could be what I was looking for ...

Thanks
Chris

--- dan tran <da...@gmail.com> wrote:

> Bind antrun:run to a phase but profile it
> 
>
http://maven.apache.org/guides/introduction/introduction-to-profiles.html
> 
> -D
> 
> On 3/15/06, haginow2001-nabble@yahoo.com
> <ha...@yahoo.com>
> wrote:
> >
> > Doesn't really work, as it doesn't execute
> anything if
> > you configure the antrun plugin according to the
> docs:
> >
> >      <plugin>
> >       
> <artifactId>maven-antrun-plugin</artifactId>
> >        <executions>
> >          <execution>
> >            <phase>generate-sources</phase>
> >            <configuration>
> >              <tasks>
> >
> >                <!--
> >                  Place any ant task here. You can
> add
> > anything
> >                  you can add between <target> and
> > </target> in a
> >                  build.xml.
> >                -->
> >
> >              </tasks>
> >            </configuration>
> >            <goals>
> >              <goal>run</goal>
> >            </goals>
> >          </execution>
> >        </executions>
> >      </plugin>
> >
> >
> > However, it looks as if we can do the plugin
> config
> > outside the <execution> tag (e.g. create a global
> > plugin config which is valid across various
> lifecycle
> > phases).
> >
> >      <plugin>
> >       
> <artifactId>maven-antrun-plugin</artifactId>
> >            <configuration>
> >              <tasks>
> >
> >                <!--
> >                  Place any ant task here. You can
> add
> > anything
> >                  you can add between <target> and
> > </target> in a
> >                  build.xml.
> >                -->
> >
> >              </tasks>
> >            </configuration>
> >            <goals>
> >              <goal>run</goal>
> >            </goals>
> >      </plugin>
> >
> > This way we can simply invoke mvn antrun:run and
> it
> > executes the specified ANT tasks.
> >
> > However, this causes a different problem. What if
> an
> > engineer has to invoke different ANT targets (e.g.
> one
> > to deploy an app on an app server, one to undeploy
> the
> > app from the app server, one to restart the app
> > server)? That's not possible as there is only a
> global
> > config which always executes the same set of ANT
> tasks
> > when executing mvn antrun:run. Perhaps that could
> be
> > simply resolved by specifying the ANT task on the
> > command-line (e.g. mvn -Dant.task=deploy
> antrun:run).
> > Any ideas on whether that's possible?
> >
> > Thanks,
> > Chris
> > But that means it only works if you have a single
> ANT
> > target
> >
> > --- dan tran <da...@gmail.com> wrote:
> >
> > > wonder it this would work
> > >
> > > maven antrun:run
> > >
> > > -D
> > >
> > >
> > > On 3/15/06, Chris Hagmann
> <ch...@yahoo.com>
> > > wrote:
> > > >
> > > > We need to execute some ANT tasks (e.g. for
> > > > redeploying a server configuration) which we
> only
> > > need
> > > > to execute every so often, but which are not
> part
> > > of
> > > > the regular build lifecycle. Hence we need to
> > > > configure the plugin, but cannot bind it to
> any of
> > > the
> > > > lifecycle phases of Maven 2.
> > > >
> > > > How can we do that?
> > > >
> > > > Thanks,
> > > > Chris
> > > >
> > > >
> > >
> >
>
---------------------------------------------------------------------
> > > > 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
> >
> >
> 


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


Re: [m2] How to configure maven-antrun plugin without binding to a lifecycle phase

Posted by dan tran <da...@gmail.com>.
Bind antrun:run to a phase but profile it

http://maven.apache.org/guides/introduction/introduction-to-profiles.html

-D

On 3/15/06, haginow2001-nabble@yahoo.com <ha...@yahoo.com>
wrote:
>
> Doesn't really work, as it doesn't execute anything if
> you configure the antrun plugin according to the docs:
>
>      <plugin>
>        <artifactId>maven-antrun-plugin</artifactId>
>        <executions>
>          <execution>
>            <phase>generate-sources</phase>
>            <configuration>
>              <tasks>
>
>                <!--
>                  Place any ant task here. You can add
> anything
>                  you can add between <target> and
> </target> in a
>                  build.xml.
>                -->
>
>              </tasks>
>            </configuration>
>            <goals>
>              <goal>run</goal>
>            </goals>
>          </execution>
>        </executions>
>      </plugin>
>
>
> However, it looks as if we can do the plugin config
> outside the <execution> tag (e.g. create a global
> plugin config which is valid across various lifecycle
> phases).
>
>      <plugin>
>        <artifactId>maven-antrun-plugin</artifactId>
>            <configuration>
>              <tasks>
>
>                <!--
>                  Place any ant task here. You can add
> anything
>                  you can add between <target> and
> </target> in a
>                  build.xml.
>                -->
>
>              </tasks>
>            </configuration>
>            <goals>
>              <goal>run</goal>
>            </goals>
>      </plugin>
>
> This way we can simply invoke mvn antrun:run and it
> executes the specified ANT tasks.
>
> However, this causes a different problem. What if an
> engineer has to invoke different ANT targets (e.g. one
> to deploy an app on an app server, one to undeploy the
> app from the app server, one to restart the app
> server)? That's not possible as there is only a global
> config which always executes the same set of ANT tasks
> when executing mvn antrun:run. Perhaps that could be
> simply resolved by specifying the ANT task on the
> command-line (e.g. mvn -Dant.task=deploy antrun:run).
> Any ideas on whether that's possible?
>
> Thanks,
> Chris
> But that means it only works if you have a single ANT
> target
>
> --- dan tran <da...@gmail.com> wrote:
>
> > wonder it this would work
> >
> > maven antrun:run
> >
> > -D
> >
> >
> > On 3/15/06, Chris Hagmann <ch...@yahoo.com>
> > wrote:
> > >
> > > We need to execute some ANT tasks (e.g. for
> > > redeploying a server configuration) which we only
> > need
> > > to execute every so often, but which are not part
> > of
> > > the regular build lifecycle. Hence we need to
> > > configure the plugin, but cannot bind it to any of
> > the
> > > lifecycle phases of Maven 2.
> > >
> > > How can we do that?
> > >
> > > Thanks,
> > > Chris
> > >
> > >
> >
> ---------------------------------------------------------------------
> > > 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: [m2] How to configure maven-antrun plugin without binding to a lifecycle phase

Posted by ha...@yahoo.com.
Doesn't really work, as it doesn't execute anything if
you configure the antrun plugin according to the docs:

      <plugin>
        <artifactId>maven-antrun-plugin</artifactId>
        <executions>
          <execution>
            <phase>generate-sources</phase>
            <configuration>
              <tasks>

                <!--
                  Place any ant task here. You can add
anything
                  you can add between <target> and
</target> in a
                  build.xml.
                -->
                
              </tasks>
            </configuration>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
        </executions>
      </plugin>


However, it looks as if we can do the plugin config
outside the <execution> tag (e.g. create a global
plugin config which is valid across various lifecycle
phases). 

      <plugin>
        <artifactId>maven-antrun-plugin</artifactId>
            <configuration>
              <tasks>

                <!--
                  Place any ant task here. You can add
anything
                  you can add between <target> and
</target> in a
                  build.xml.
                -->
                
              </tasks>
            </configuration>
            <goals>
              <goal>run</goal>
            </goals>
      </plugin>

This way we can simply invoke mvn antrun:run and it
executes the specified ANT tasks. 

However, this causes a different problem. What if an
engineer has to invoke different ANT targets (e.g. one
to deploy an app on an app server, one to undeploy the
app from the app server, one to restart the app
server)? That's not possible as there is only a global
config which always executes the same set of ANT tasks
when executing mvn antrun:run. Perhaps that could be
simply resolved by specifying the ANT task on the
command-line (e.g. mvn -Dant.task=deploy antrun:run).
Any ideas on whether that's possible?

Thanks,
Chris
But that means it only works if you have a single ANT
target

--- dan tran <da...@gmail.com> wrote:

> wonder it this would work
> 
> maven antrun:run
> 
> -D
> 
> 
> On 3/15/06, Chris Hagmann <ch...@yahoo.com>
> wrote:
> >
> > We need to execute some ANT tasks (e.g. for
> > redeploying a server configuration) which we only
> need
> > to execute every so often, but which are not part
> of
> > the regular build lifecycle. Hence we need to
> > configure the plugin, but cannot bind it to any of
> the
> > lifecycle phases of Maven 2.
> >
> > How can we do that?
> >
> > Thanks,
> > Chris
> >
> >
>
---------------------------------------------------------------------
> > 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: [m2] How to configure maven-antrun plugin without binding to a lifecycle phase

Posted by dan tran <da...@gmail.com>.
wonder it this would work

maven antrun:run

-D


On 3/15/06, Chris Hagmann <ch...@yahoo.com> wrote:
>
> We need to execute some ANT tasks (e.g. for
> redeploying a server configuration) which we only need
> to execute every so often, but which are not part of
> the regular build lifecycle. Hence we need to
> configure the plugin, but cannot bind it to any of the
> lifecycle phases of Maven 2.
>
> How can we do that?
>
> Thanks,
> Chris
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>