You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Lóránt Pintér <lo...@gmail.com> on 2010/03/19 12:08:06 UTC
Defining "utility" plugin executions in a multi-module project
Hi,
I have a big project, with 30-ish modules. Some of the modules need
native DLLs to be present in target/lib, so I want to use
m-dependency-p to unpack/copy them in place during the initialize
phase.
Let's just say there are two sets of these DLLs. Some of the modules
need one set, while some of the others need the other set. What I
would like is to avoid redundantly defining these executions in every
child POM that requires them, and only define both sets in the parent
POM, and "call" the appropriate one in the modules themselves.
But if I simply define them in the <pluginManagement> of the parent, like:
<pluginManagement>
<plugins>
<!-- Also copy the MS Visual C Runtime -->
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack-native-libs</id>
<phase>initialize</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>com.microsoft.crt</groupId>
<artifactId>crt</artifactId>
<version>7.10</version>
</artifactItem>
</artifactItems>
<outputDirectory>${project.build.directory}/lib</outputDirectory>
</configuration>
</execution>
<execution>
<id>unpack-database-native-libs</id>
<phase>initialize</phase>
<goals>
<goal>unpack-dependencies</goal>
</goals>
<configuration>
<includeGroupIds>com.jadozoom</includeGroupIds>
<includes>*.dll</includes>
<outputDirectory>${project.build.directory}/lib</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
...and reference one of them in a child POM:
<build>
<plugins>
<!-- Copy native libraries to target/lib -->
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack-native-libs</id>
</execution>
</executions>
</plugin>
What I get is that _both_ executions I defined in parent get executed.
What I tried next is to set <inherited>false</inherited> in the parent
POM for the executions, but then _none_ of them get executed in the
child build.
Is there a way (maybe a completely different one) to achieve what I want?
BTW, I'm using Maven 3 for all this.
--
Thanks,
Lóránt
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Defining "utility" plugin executions in a multi-module project
Posted by Lóránt Pintér <lo...@gmail.com>.
It seems that Maven 3 and Maven 2 is handling
<inherited>false</inherited> differently.
Maven 3.0-alpha-6 executes none of the executions marked with
<inherited>false</inherited>, while Maven 2.2.1 executes all of them.
What I would like is to only execute the one that is explicitly called
in the module. See attached test project.
Lóránt
2010/3/19 Lóránt Pintér <lo...@gmail.com>:
> Hi,
>
> I have a big project, with 30-ish modules. Some of the modules need
> native DLLs to be present in target/lib, so I want to use
> m-dependency-p to unpack/copy them in place during the initialize
> phase.
>
> Let's just say there are two sets of these DLLs. Some of the modules
> need one set, while some of the others need the other set. What I
> would like is to avoid redundantly defining these executions in every
> child POM that requires them, and only define both sets in the parent
> POM, and "call" the appropriate one in the modules themselves.
>
> But if I simply define them in the <pluginManagement> of the parent, like:
>
> <pluginManagement>
> <plugins>
> <!-- Also copy the MS Visual C Runtime -->
> <plugin>
> <artifactId>maven-dependency-plugin</artifactId>
> <executions>
> <execution>
> <id>unpack-native-libs</id>
> <phase>initialize</phase>
> <goals>
> <goal>unpack</goal>
> </goals>
> <configuration>
> <artifactItems>
> <artifactItem>
> <groupId>com.microsoft.crt</groupId>
> <artifactId>crt</artifactId>
> <version>7.10</version>
> </artifactItem>
> </artifactItems>
> <outputDirectory>${project.build.directory}/lib</outputDirectory>
> </configuration>
> </execution>
> <execution>
> <id>unpack-database-native-libs</id>
> <phase>initialize</phase>
> <goals>
> <goal>unpack-dependencies</goal>
> </goals>
> <configuration>
> <includeGroupIds>com.jadozoom</includeGroupIds>
> <includes>*.dll</includes>
> <outputDirectory>${project.build.directory}/lib</outputDirectory>
> </configuration>
> </execution>
> </executions>
> </plugin>
> </plugins>
> </pluginManagement>
>
> ...and reference one of them in a child POM:
>
> <build>
> <plugins>
> <!-- Copy native libraries to target/lib -->
> <plugin>
> <artifactId>maven-dependency-plugin</artifactId>
> <executions>
> <execution>
> <id>unpack-native-libs</id>
> </execution>
> </executions>
> </plugin>
>
> What I get is that _both_ executions I defined in parent get executed.
> What I tried next is to set <inherited>false</inherited> in the parent
> POM for the executions, but then _none_ of them get executed in the
> child build.
>
> Is there a way (maybe a completely different one) to achieve what I want?
>
> BTW, I'm using Maven 3 for all this.
>
> --
> Thanks,
> Lóránt
>