You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Rémy Sanlaville <re...@gmail.com> on 2007/07/12 16:20:55 UTC
[M2]skip parent
Hi,
I wonder if it is possible in a multimodules project to skip the execution
just for the parent.
For instance, if you have 2 modules and you declare the maven-antrun-plugin
configuration
in the your parent pom :
<project>
...
<modules>
<module>module1</module>
<module>module2</module>
</modules>
<build>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>validate</phase>
<configuration>
<tasks>
<echo message="project.build.directory = ${
project.build.directory}"/>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
if you execute maven 2 at the parent level, you have something like that :
[INFO] Executing tasks
[echo] project.build.directory =
P:\03-Maven\dev\tests\multimodules\test\target
[INFO] Executed tasks
[INFO]
----------------------------------------------------------------------------
[INFO] Building Unnamed - tests.multimodules:module1:jar:1.0-SNAPSHOT
[INFO] task-segment: [validate]
[INFO]
----------------------------------------------------------------------------
[INFO] [antrun:run {execution: default}]
[INFO] Executing tasks
[echo] project.build.directory =
P:\03-Maven\dev\tests\multimodules\test\module1\target
[INFO] Executed tasks
[INFO]
----------------------------------------------------------------------------
[INFO] Building Unnamed - tests.multimodules:module2:jar:1.0-SNAPSHOT
[INFO] task-segment: [validate]
[INFO]
----------------------------------------------------------------------------
[INFO] [antrun:run {execution: default}]
[INFO] Executing tasks
[echo] project.build.directory =
P:\03-Maven\dev\tests\multimodules\test\module2\target
[INFO] Executed tasks
So maven 2 execute the antrun plugin first at parent level then module1 and
module 2.
It's fine with a such simple example. But if you use for instance weblogic
ant tasks, it's a problem.
The build failed because it can't deploy a war package at the parent level.
So, It would be very nice
to can skip the execution at the parent level.
PS:
- I already try the weblogic-wlss-maven-plugin but it does not work very
well
- Of course, I can copy the configuration just in the modules or execute
maven only
in each module but it not what I want to do (imagine if you have several
modules...)
- I am also interesting to know if it possible.
Rémy
Re: [M2]skip parent
Posted by Rémy Sanlaville <re...@gmail.com>.
> For the moment maven-antrun-plugin do not allows you to skip plugin's
> execution
> cf. http://jira.codehaus.org/browse/MANTRUN-65 , Vote for it ! :-)
>
You can also vote for it !
http://jira.codehaus.org/browse/MNG-3102
Rémy
Re: [M2]skip parent
Posted by Rémy Sanlaville <re...@gmail.com>.
As promised, I tried for the multiple executions.
For the moment maven-antrun-plugin do not allows you to skip plugin's
execution
cf. http://jira.codehaus.org/browse/MANTRUN-65, Vote for it ! :-)
But you can do this :
parent-pom :
------------------
<build>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>antrun_id1</id>
<phase>validate</phase>
<configuration>
<tasks>
<echo message="project.build.directory =
${project.build.directory}"/>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
<execution>
<id>antrun_id2</id>
<phase>validate</phase>
<configuration>
<tasks>
<echo message="antrun id 2 execution"/>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
module1-pom:
----------------------
<build>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>antrun_id1</id>
<phase>validate</phase>
<configuration>
<tasks>
<echo message="NOTHING TO DO..."/>
</tasks>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
It results:
-------------
[INFO]
----------------------------------------------------------------------------
[INFO] Building Unnamed - tests.multimodules:module1:jar:1.0-SNAPSHOT
[INFO] task-segment: [validate]
[INFO]
----------------------------------------------------------------------------
[INFO] [antrun:run {execution: antrun_id1}]
[INFO] Executing tasks
[echo] NOTHING TO DO...
[INFO] Executed tasks
[INFO] [antrun:run {execution: antrun_id2}]
[INFO] Executing tasks
[echo] antrun id 2 execution
[INFO] Executed tasks
[INFO]
----------------------------------------------------------------------------
[INFO] Building Unnamed - tests.multimodules:module2:jar:1.0-SNAPSHOT
[INFO] task-segment: [validate]
[INFO]
----------------------------------------------------------------------------
[INFO] [antrun:run {execution: antrun_id1}]
[INFO] Executing tasks
[echo] project.build.directory =
P:\03-Maven\dev\tests\multimodules\skip-parent\02-pluginManagement\module2\target
[INFO] Executed tasks
[INFO] [antrun:run {execution: antrun_id2}]
[INFO] Executing tasks
[echo] antrun id 2 execution
[INFO] Executed tasks
---
So it seems to be good !
Nevertheless, it's better to can skip the antrun execution.
Rémy
Re: [M2]skip parent
Posted by Rémy Sanlaville <re...@gmail.com>.
Hi Wendy,
Usually you would put it in pluginManagement in the parent, but I'm
> not sure how well that's going to work if you ever have multiple
> executions in antrun. (BTW, it's a good idea to give that <execution>
> an <id>.)
That's what I needed. Many thanks.
For the moment I don't need multiple executions. I will try and let you know
if it works. You are right about the id, I will do.
Rémy
Re: [M2]skip parent
Posted by Wendy Smoak <ws...@gmail.com>.
On 7/12/07, Rémy Sanlaville <re...@gmail.com> wrote:
> It's fine with a such simple example. But if you use for instance weblogic
> ant tasks, it's a problem.
> The build failed because it can't deploy a war package at the parent level.
> So, It would be very nice
> to can skip the execution at the parent level.
Usually you would put it in pluginManagement in the parent, but I'm
not sure how well that's going to work if you ever have multiple
executions in antrun. (BTW, it's a good idea to give that <execution>
an <id>.)
--
Wendy
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: [M2]skip parent
Posted by Rémy Sanlaville <re...@gmail.com>.
Hi Tim
you should split the common configuration (parent pom) and the project
> aggregation (<modules/> tag) in two separate poms:
>
> myproject
> |
> |-myproject-parent
> |-module1
> |-module2
>
> You then would have all three modules declared in the top level pom and
> module1 and module2 would have myproject-parent as their parent pom.
>
>
It works well. Many Thanks.
As Wendy mentioned, I think I will use pluginManagement instead.
I think it's easier to maintain and explain to the team.
Rémy
Re: [M2]skip parent
Posted by Tim Kettler <ti...@udo.edu>.
Hi,
you should split the common configuration (parent pom) and the project
aggregation (<modules/> tag) in two separate poms:
myproject
|
|-myproject-parent
|-module1
|-module2
You then would have all three modules declared in the top level pom and
module1 and module2 would have myproject-parent as their parent pom.
If the parent pom is not just used for this specific project but common
to modules in other projects too (think of a parent for all ejb modules)
you even could make the parent-pom a project of its own and deploy it to
a internal repository and then reference it in the respective modules.
-Tim
Rémy Sanlaville schrieb:
> Hi,
>
> I wonder if it is possible in a multimodules project to skip the execution
> just for the parent.
>
> For instance, if you have 2 modules and you declare the maven-antrun-plugin
> configuration
> in the your parent pom :
>
> <project>
>
> ...
>
> <modules>
> <module>module1</module>
> <module>module2</module>
> </modules>
>
> <build>
> <plugins>
> <plugin>
> <artifactId>maven-antrun-plugin</artifactId>
> <executions>
> <execution>
> <phase>validate</phase>
> <configuration>
> <tasks>
> <echo message="project.build.directory = ${
> project.build.directory}"/>
> </tasks>
> </configuration>
> <goals>
> <goal>run</goal>
> </goals>
> </execution>
> </executions>
> </plugin>
> </plugins>
> </build>
> </project>
>
> if you execute maven 2 at the parent level, you have something like that :
>
> [INFO] Executing tasks
> [echo] project.build.directory =
> P:\03-Maven\dev\tests\multimodules\test\target
> [INFO] Executed tasks
> [INFO]
> ----------------------------------------------------------------------------
>
> [INFO] Building Unnamed - tests.multimodules:module1:jar:1.0-SNAPSHOT
> [INFO] task-segment: [validate]
> [INFO]
> ----------------------------------------------------------------------------
>
> [INFO] [antrun:run {execution: default}]
> [INFO] Executing tasks
> [echo] project.build.directory =
> P:\03-Maven\dev\tests\multimodules\test\module1\target
> [INFO] Executed tasks
> [INFO]
> ----------------------------------------------------------------------------
>
> [INFO] Building Unnamed - tests.multimodules:module2:jar:1.0-SNAPSHOT
> [INFO] task-segment: [validate]
> [INFO]
> ----------------------------------------------------------------------------
>
> [INFO] [antrun:run {execution: default}]
> [INFO] Executing tasks
> [echo] project.build.directory =
> P:\03-Maven\dev\tests\multimodules\test\module2\target
> [INFO] Executed tasks
>
> So maven 2 execute the antrun plugin first at parent level then module1 and
> module 2.
>
> It's fine with a such simple example. But if you use for instance weblogic
> ant tasks, it's a problem.
> The build failed because it can't deploy a war package at the parent level.
> So, It would be very nice
> to can skip the execution at the parent level.
>
> PS:
> - I already try the weblogic-wlss-maven-plugin but it does not work very
> well
> - Of course, I can copy the configuration just in the modules or execute
> maven only
> in each module but it not what I want to do (imagine if you have several
> modules...)
> - I am also interesting to know if it possible.
>
> Rémy
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org