You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Farhan Sarwar <fa...@gmail.com> on 2007/08/16 19:30:27 UTC
Re : Invoke a plug-in/goal configured in a pom.xml from cmd line
Thanks for the follow-up Steve, I am still hoping that someone has a
solution to what I want to achieve but at the same time I think what you
have suggested is certainly a good simulation for the same…now am still
trying to configure the pom as you suggested (as below) so that I can
activate/invoke the profile at the initialize phase..this is what I have
come up with but it aint working, I think I am missing out something..can
you suggest…am invoking it with mvn –P myprofile initialize..but it doesn't
perform the delete task..though the same works if outside the profile..
<profiles>
<profile>
<id>myprofile</id>
<build>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>execution2</id>
<configuration>
<tasks>
<delete file="lib/test2.txt"/>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
Thanks in advance and Regards,
Farhan.
>Hi Farhan,
>
>I don't know how to do exactly what you want, but you can do something
>close with a profile.
>
>If you put the antrun execution (or any other execution) in a profile
>with no explicit activation spec, and bind it to a really early phase
>(say, the "initialize" phase), then you can invoke it from the command
>line like this:
>
> mvn -P profile-id initialize
>
>Steve
>
>Farhan Sarwar wrote:
> Hi All,
>
>
>
> Is there a way I can invoke a plug-in/goal (not linked with any phase)
> configured in a project's pom.xml (within an execution tag) from the
command
> line directly, also the idea is to invoke the goal irrespective of the
maven
> build cycle.
>
>
>
> To be more precise let's say if I have a maven-ant-run: run (plug-in:goal)
> configured (as below) with 2 executions (i.e. execution1 associated with
> validate phase and execution2 not linked to any phase) how can I invoke
the
> configuration as configured in id=execution2 from command line directly
e.g.
> something like mvn antrun:run "execution2" so that it gets executed
> independent of maven phase(s)/build-cycle.
>
>
>
> <build>
>
> <plugins>
>
> <plugin>
>
> <artifactId>maven-antrun-plugin</artifactId>
>
> <executions>
>
> <execution>
>
> <id>execution1</id>
>
> <phase>validate</phase>
>
> <configuration>
>
> <tasks>
>
> <delete file="lib/test1.txt"/>
>
> </tasks>
>
> </configuration>
>
> <goals>
>
> <goal>run</goal>
>
> </goals>
>
> </execution>
>
> <execution>
>
> <id>execution2</id>
>
> <configuration>
>
> <tasks>
>
> <delete file="lib/test2.txt"/>
>
> </tasks>
>
> </configuration>
>
> <goals>
>
> <goal>run</goal>
>
> </goals>
>
> </execution>
>
> </executions>
>
> </plugin>
>
> </plugins>
>
> </build>
>
>
>
> Thanks and Regards,
>
>
>
> Farhan.
>
Re: Re : Invoke a plug-in/goal configured in a pom.xml from cmd line
Posted by Wayne Fay <wa...@gmail.com>.
If you put it directly in the pom, then you could call "mvn
plugin-name:goal" and it would execute the plugin directly. It should
probably work with profiles as well.
But really, there is nothing stopping you from just having a build.xml
file next to your pom.xml file and then calling ant directly to do
little things like this. I would probably go this route myself.
Wayne
On 8/16/07, Farhan Sarwar <fa...@gmail.com> wrote:
> I just realized that i have to put in a "<phase>" tag in order to make it
> work, i thought we can still skip it, since we were specifying it anyways on
> invoking it from the command line, though am still trying to figure out a
> way i can just invoke a plugin-in/goal that is declared/configured in a
> pom..
>
>
> On 8/16/07, Farhan Sarwar <fa...@gmail.com> wrote:
> >
> > Thanks for the follow-up Steve, I am still hoping that someone has a
> > solution to what I want to achieve but at the same time I think what you
> > have suggested is certainly a good simulation for the same…now am still
> > trying to configure the pom as you suggested (as below) so that I can
> > activate/invoke the profile at the initialize phase..this is what I have
> > come up with but it aint working, I think I am missing out something..can
> > you suggest…am invoking it with mvn –P myprofile initialize..but it
> doesn't
> > perform the delete task..though the same works if outside the profile..
> >
> >
> >
> > <profiles>
> >
> > <profile>
> >
> > <id>myprofile</id>
> >
> > <build>
> >
> > <plugins>
> >
> > <plugin>
> >
> > <artifactId>maven-antrun-plugin</artifactId>
> >
> > <executions>
> >
> > <execution>
> >
> > <id>execution2</id>
> >
> > <configuration>
> >
> > <tasks>
> >
> > <delete file="lib/test2.txt"/>
> >
> > </tasks>
> >
> > </configuration>
> >
> > <goals>
> >
> > <goal>run</goal>
> >
> > </goals>
> >
> > </execution>
> >
> > </executions>
> >
> > </plugin>
> >
> > </plugins>
> >
> > </build>
> >
> > </profile>
> >
> > </profiles>
> >
> >
> >
> > Thanks in advance and Regards,
> >
> >
> >
> > Farhan.
> >
> >
> >
> >
> >
> > >Hi Farhan,
> >
> > >
> >
> > >I don't know how to do exactly what you want, but you can do something
> >
> > >close with a profile.
> >
> > >
> >
> > >If you put the antrun execution (or any other execution) in a profile
> >
> > >with no explicit activation spec, and bind it to a really early phase
> >
> > >(say, the "initialize" phase), then you can invoke it from the command
> >
> > >line like this:
> >
> > >
> >
> > > mvn -P profile-id initialize
> >
> > >
> >
> > >Steve
> >
> > >
> >
> > >Farhan Sarwar wrote:
> >
> > > Hi All,
> >
> > >
> >
> > >
> >
> > >
> >
> > > Is there a way I can invoke a plug-in/goal (not linked with any phase)
> >
> > > configured in a project's pom.xml (within an execution tag) from the
> > command
> >
> > > line directly, also the idea is to invoke the goal irrespective of the
> > maven
> >
> > > build cycle.
> >
> > >
> >
> > >
> >
> > >
> >
> > > To be more precise let's say if I have a maven-ant-run: run
> > (plug-in:goal)
> >
> > > configured (as below) with 2 executions (i.e. execution1 associated with
> >
> > > validate phase and execution2 not linked to any phase) how can I invoke
> > the
> >
> > > configuration as configured in id=execution2 from command line directly
> > e.g.
> >
> > > something like mvn antrun:run "execution2" so that it gets executed
> >
> > > independent of maven phase(s)/build-cycle.
> >
> > >
> >
> > >
> >
> > >
> >
> > > <build>
> >
> > >
> >
> > > <plugins>
> >
> > >
> >
> > > <plugin>
> >
> > >
> >
> > > <artifactId>maven-antrun-plugin</artifactId>
> >
> > >
> >
> > > <executions>
> >
> > >
> >
> > > <execution>
> >
> > >
> >
> > > <id>execution1</id>
> >
> > >
> >
> > > <phase>validate</phase>
> >
> > >
> >
> > > <configuration>
> >
> > >
> >
> > > <tasks>
> >
> > >
> >
> > > <delete file="lib/test1.txt"/>
> >
> > >
> >
> > > </tasks>
> >
> > >
> >
> > > </configuration>
> >
> > >
> >
> > > <goals>
> >
> > >
> >
> > > <goal>run</goal>
> >
> > >
> >
> > > </goals>
> >
> > >
> >
> > > </execution>
> >
> > >
> >
> > > <execution>
> >
> > >
> >
> > > <id>execution2</id>
> >
> > >
> >
> > > <configuration>
> >
> > >
> >
> > > <tasks>
> >
> > >
> >
> > > <delete file="lib/test2.txt"/>
> >
> > >
> >
> > > </tasks>
> >
> > >
> >
> > > </configuration>
> >
> > >
> >
> > > <goals>
> >
> > >
> >
> > > <goal>run</goal>
> >
> > >
> >
> > > </goals>
> >
> > >
> >
> > > </execution>
> >
> > >
> >
> > > </executions>
> >
> > >
> >
> > > </plugin>
> >
> > >
> >
> > > </plugins>
> >
> > >
> >
> > > </build>
> >
> > >
> >
> > >
> >
> > >
> >
> > > Thanks and Regards,
> >
> > >
> >
> > >
> >
> > >
> >
> > > Farhan.
> >
> > >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Re : Invoke a plug-in/goal configured in a pom.xml from cmd line
Posted by Farhan Sarwar <fa...@gmail.com>.
I just realized that i have to put in a "<phase>" tag in order to make it
work, i thought we can still skip it, since we were specifying it anyways on
invoking it from the command line, though am still trying to figure out a
way i can just invoke a plugin-in/goal that is declared/configured in a
pom..
On 8/16/07, Farhan Sarwar <fa...@gmail.com> wrote:
>
> Thanks for the follow-up Steve, I am still hoping that someone has a
> solution to what I want to achieve but at the same time I think what you
> have suggested is certainly a good simulation for the same…now am still
> trying to configure the pom as you suggested (as below) so that I can
> activate/invoke the profile at the initialize phase..this is what I have
> come up with but it aint working, I think I am missing out something..can
> you suggest…am invoking it with mvn –P myprofile initialize..but it doesn't
> perform the delete task..though the same works if outside the profile..
>
>
>
> <profiles>
>
> <profile>
>
> <id>myprofile</id>
>
> <build>
>
> <plugins>
>
> <plugin>
>
> <artifactId>maven-antrun-plugin</artifactId>
>
> <executions>
>
> <execution>
>
> <id>execution2</id>
>
> <configuration>
>
> <tasks>
>
> <delete file="lib/test2.txt"/>
>
> </tasks>
>
> </configuration>
>
> <goals>
>
> <goal>run</goal>
>
> </goals>
>
> </execution>
>
> </executions>
>
> </plugin>
>
> </plugins>
>
> </build>
>
> </profile>
>
> </profiles>
>
>
>
> Thanks in advance and Regards,
>
>
>
> Farhan.
>
>
>
>
>
> >Hi Farhan,
>
> >
>
> >I don't know how to do exactly what you want, but you can do something
>
> >close with a profile.
>
> >
>
> >If you put the antrun execution (or any other execution) in a profile
>
> >with no explicit activation spec, and bind it to a really early phase
>
> >(say, the "initialize" phase), then you can invoke it from the command
>
> >line like this:
>
> >
>
> > mvn -P profile-id initialize
>
> >
>
> >Steve
>
> >
>
> >Farhan Sarwar wrote:
>
> > Hi All,
>
> >
>
> >
>
> >
>
> > Is there a way I can invoke a plug-in/goal (not linked with any phase)
>
> > configured in a project's pom.xml (within an execution tag) from the
> command
>
> > line directly, also the idea is to invoke the goal irrespective of the
> maven
>
> > build cycle.
>
> >
>
> >
>
> >
>
> > To be more precise let's say if I have a maven-ant-run: run
> (plug-in:goal)
>
> > configured (as below) with 2 executions (i.e. execution1 associated with
>
> > validate phase and execution2 not linked to any phase) how can I invoke
> the
>
> > configuration as configured in id=execution2 from command line directly
> e.g.
>
> > something like mvn antrun:run "execution2" so that it gets executed
>
> > independent of maven phase(s)/build-cycle.
>
> >
>
> >
>
> >
>
> > <build>
>
> >
>
> > <plugins>
>
> >
>
> > <plugin>
>
> >
>
> > <artifactId>maven-antrun-plugin</artifactId>
>
> >
>
> > <executions>
>
> >
>
> > <execution>
>
> >
>
> > <id>execution1</id>
>
> >
>
> > <phase>validate</phase>
>
> >
>
> > <configuration>
>
> >
>
> > <tasks>
>
> >
>
> > <delete file="lib/test1.txt"/>
>
> >
>
> > </tasks>
>
> >
>
> > </configuration>
>
> >
>
> > <goals>
>
> >
>
> > <goal>run</goal>
>
> >
>
> > </goals>
>
> >
>
> > </execution>
>
> >
>
> > <execution>
>
> >
>
> > <id>execution2</id>
>
> >
>
> > <configuration>
>
> >
>
> > <tasks>
>
> >
>
> > <delete file="lib/test2.txt"/>
>
> >
>
> > </tasks>
>
> >
>
> > </configuration>
>
> >
>
> > <goals>
>
> >
>
> > <goal>run</goal>
>
> >
>
> > </goals>
>
> >
>
> > </execution>
>
> >
>
> > </executions>
>
> >
>
> > </plugin>
>
> >
>
> > </plugins>
>
> >
>
> > </build>
>
> >
>
> >
>
> >
>
> > Thanks and Regards,
>
> >
>
> >
>
> >
>
> > Farhan.
>
> >
>
>
>
>
>
>
>
>
>
>
>