views:

143

answers:

3

I'm building my project using the following POM:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"&gt;
<modelVersion>4.0.0</modelVersion>
<groupId>build.local</groupId>
<artifactId>build-local</artifactId>
<packaging>pom</packaging>
<name>${project.artifactId}</name>
<version>0-SNAPSHOT</version>
<description></description>
<inceptionYear>2009</inceptionYear>
<modules>
 <module>module1</module>
 <module>module2</module>
</modules>
<build>
    <pluginManagement>
     <plugins>
      <plugin>
       <groupId>org.codehaus.mojo</groupId>
       <artifactId>buildnumber-maven-plugin</artifactId>
       <version>1.0-beta-2</version>
      </plugin>
     </plugins>
    </pluginManagement>
    <plugins>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>exec-maven-plugin</artifactId>
            <version>1.1.1</version>
            <configuration>
                <executable>deploy.bat</executable>
            <configuration>
        </plugin>
    </plugins>
</build>
</project>

The build works fine. The deployment using the plugin works as well. The only problem I have: maven calls deploy.bat twice, once for every module. However, I only need it executed once. How can I do that?

A: 

You can just put the plugin in one of your modules.

Mike Pone
+1  A: 

Move the < plugin >...< /plugin > directive in to the module1/pom.xml file.

Chris Nava
Hmm, is there no other way if putting the plugin into the module is not an option?
Bob
Not unless the plugin can be configured with (filters perhaps?) to avoid the second module. Can you modify deploy.bat to do nothing when run on the second module? Perhaps with an IF EXISTS check for a trigger file/folder....
Chris Nava
Modifying deploy.bat did the trick. Thanks.
Bob
A: 

Referencing this http://maven.apache.org/ref/2.2.1/maven-model/maven.html ... ... set inherited value to false (default is true) and childs projects will not inherit the plugin.

Pedro Mendes