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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]