tags:

views:

325

answers:

2

In a multi-module project, how can you specify that you want to execute a plugin goal in all the child-modules, but not on the parent project? There is <pluginManagement>, but that only defines the configuration for the execution -- the child modules would still need to reference the plugin to get the goal executed:

[...] However, this only configures plugins that are actually referenced within the plugins element in the children. (POM Reference)

Any other way to achieve this?

UPDATE: I've tried this according to Pascal's advice:

<!-- ... -->
<packaging>pom</packaging>
<modules>
  <module>child</module>
</modules>

<build>
  <plugins>
    <plugin>
      <artifactId>maven-jar-plugin</artifactId>
      <executions>
        <execution>
        <phase>integration-test</phase>
        <goals>
          <goal>jar</goal>
        </goals>
        </execution>
      </executions>
    </plugin>
  </plugins>
</build>
<!-- ... -->

This will still generate a .jar for the parent project, even though the jar goal is bound to the integration-test phase.

+1  A: 
Pascal Thivent
Pascal answer is correct. In parent POM `<pluginManagement>`section defines conifugration for plugins but not forces theirs executions, you need to place also `<plugins>` section to spread excutions of these plugins into child modules.
cetnar
I've tried this with the `maven-jar-plugin`, but it still creates a .jar for my parent POM project. I'll add details to the question.
Lóránt Pintér
A: 

Anyone have news about this problem, i have the same problem with my plugin and don`t seem to be able to solve it.

Any help appreciated. Thank.

Kaeluan