You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Johannes Ernst <jo...@gmail.com> on 2015/05/13 23:17:26 UTC
use of exec in multiple phases
I’d like to invoke exec-maven-plugin with different arguments during different phases of the build, and I’m failing. I hope somebody can help me.
This is what works:
parent pom: (invokes a code generator)
<pluginManagement>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.4.0</version>
<executions>
<execution>
<id>generate-sources</id>
<phase>generate-sources</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>code-generator-executable</executable>
….
project pom:
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
</plugin>
….
Now I’d like to also invoke exec just prior to surefire running tests, but only in the project pom (not in other projects that use the same parent). So I want to attach it to
<phase>process-tests-classes</phase>
and for argument’s sake, let’s say I simply want it to invoke “echo ‘I succeeded in attaching another exec’”
Where would I declare what?
Thanks,
Johannes.
P.S. I haven’t gotten any responses to two previous questions on this list this month; I hope this one will fare better.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: use of exec in multiple phases
Posted by Manfred Moser <ma...@mosabuam.com>.
Correct. If you use the same id it should override the config in the inherited one and stick to have one config.
Btw. just run
mvn help:effective-pom
to see the inheritance in action.
Or use the M2e pom editor and check out the effctive pom tab.
manfred
Christopher wrote on 13.05.2015 16:15:
> You'll probably have to give each execution a unique id.
>
> On Wed, May 13, 2015, 18:32 Manfred Moser <ma...@mosabuam.com> wrote:
>
>> You should be able to just add another execution into the project pom. The
>> plugin mgt will be inherited and merged and voila.
>>
>> manfred
>>
>> Johannes Ernst wrote on 13.05.2015 14:17:
>>
>> > I’d like to invoke exec-maven-plugin with different arguments during
>> > different phases of the build, and I’m failing. I hope somebody can help
>> me.
>> >
>> > This is what works:
>> >
>> > parent pom: (invokes a code generator)
>> >
>> > <pluginManagement>
>> > <plugins>
>> > <plugin>
>> > <groupId>org.codehaus.mojo</groupId>
>> > <artifactId>exec-maven-plugin</artifactId>
>> > <version>1.4.0</version>
>> > <executions>
>> > <execution>
>> > <id>generate-sources</id>
>> > <phase>generate-sources</phase>
>> > <goals>
>> > <goal>exec</goal>
>> > </goals>
>> > <configuration>
>> >
>> <executable>code-generator-executable</executable>
>> > ….
>> >
>> > project pom:
>> >
>> > <build>
>> > <plugins>
>> > <plugin>
>> > <groupId>org.codehaus.mojo</groupId>
>> > <artifactId>exec-maven-plugin</artifactId>
>> > </plugin>
>> > ….
>> >
>> > Now I’d like to also invoke exec just prior to surefire running tests,
>> but
>> > only in the project pom (not in other projects that use the same
>> parent). So I
>> > want to attach it to
>> >
>> > <phase>process-tests-classes</phase>
>> >
>> > and for argument’s sake, let’s say I simply want it to invoke “echo
>> ‘I
>> > succeeded in attaching another exec’”
>> >
>> > Where would I declare what?
>> >
>> > Thanks,
>> >
>> >
>> >
>> > Johannes.
>> >
>> > P.S. I haven’t gotten any responses to two previous questions on this
>> list
>> > this month; I hope this one will fare better.
>> >
>> >
>> > ---------------------------------------------------------------------
>> > 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: use of exec in multiple phases
Posted by Christopher <ct...@apache.org>.
You'll probably have to give each execution a unique id.
On Wed, May 13, 2015, 18:32 Manfred Moser <ma...@mosabuam.com> wrote:
> You should be able to just add another execution into the project pom. The
> plugin mgt will be inherited and merged and voila.
>
> manfred
>
> Johannes Ernst wrote on 13.05.2015 14:17:
>
> > I’d like to invoke exec-maven-plugin with different arguments during
> > different phases of the build, and I’m failing. I hope somebody can help
> me.
> >
> > This is what works:
> >
> > parent pom: (invokes a code generator)
> >
> > <pluginManagement>
> > <plugins>
> > <plugin>
> > <groupId>org.codehaus.mojo</groupId>
> > <artifactId>exec-maven-plugin</artifactId>
> > <version>1.4.0</version>
> > <executions>
> > <execution>
> > <id>generate-sources</id>
> > <phase>generate-sources</phase>
> > <goals>
> > <goal>exec</goal>
> > </goals>
> > <configuration>
> >
> <executable>code-generator-executable</executable>
> > ….
> >
> > project pom:
> >
> > <build>
> > <plugins>
> > <plugin>
> > <groupId>org.codehaus.mojo</groupId>
> > <artifactId>exec-maven-plugin</artifactId>
> > </plugin>
> > ….
> >
> > Now I’d like to also invoke exec just prior to surefire running tests,
> but
> > only in the project pom (not in other projects that use the same
> parent). So I
> > want to attach it to
> >
> > <phase>process-tests-classes</phase>
> >
> > and for argument’s sake, let’s say I simply want it to invoke “echo ‘I
> > succeeded in attaching another exec’”
> >
> > Where would I declare what?
> >
> > Thanks,
> >
> >
> >
> > Johannes.
> >
> > P.S. I haven’t gotten any responses to two previous questions on this
> list
> > this month; I hope this one will fare better.
> >
> >
> > ---------------------------------------------------------------------
> > 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: use of exec in multiple phases
Posted by Manfred Moser <ma...@mosabuam.com>.
You should be able to just add another execution into the project pom. The plugin mgt will be inherited and merged and voila.
manfred
Johannes Ernst wrote on 13.05.2015 14:17:
> I’d like to invoke exec-maven-plugin with different arguments during
> different phases of the build, and I’m failing. I hope somebody can help me.
>
> This is what works:
>
> parent pom: (invokes a code generator)
>
> <pluginManagement>
> <plugins>
> <plugin>
> <groupId>org.codehaus.mojo</groupId>
> <artifactId>exec-maven-plugin</artifactId>
> <version>1.4.0</version>
> <executions>
> <execution>
> <id>generate-sources</id>
> <phase>generate-sources</phase>
> <goals>
> <goal>exec</goal>
> </goals>
> <configuration>
> <executable>code-generator-executable</executable>
> ….
>
> project pom:
>
> <build>
> <plugins>
> <plugin>
> <groupId>org.codehaus.mojo</groupId>
> <artifactId>exec-maven-plugin</artifactId>
> </plugin>
> ….
>
> Now I’d like to also invoke exec just prior to surefire running tests, but
> only in the project pom (not in other projects that use the same parent). So I
> want to attach it to
>
> <phase>process-tests-classes</phase>
>
> and for argument’s sake, let’s say I simply want it to invoke “echo ‘I
> succeeded in attaching another exec’”
>
> Where would I declare what?
>
> Thanks,
>
>
>
> Johannes.
>
> P.S. I haven’t gotten any responses to two previous questions on this list
> this month; I hope this one will fare better.
>
>
> ---------------------------------------------------------------------
> 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