Hi,

I have the following project structure:

P1 (packaging="pom", w/ modules: P1 and P2)
   --- P11 (parent=P1, jar)
   --- P12 (parent=P1, jar)

Now I would like to configure the pom.xml for P1 to declare the maven-war-plugin (please see the pom.xml below) under the webapp profile so that we can produce the war for web deployment. This way, this plugin will be inherited by P11 and P12. But during the reactor build, the maven-war-plugin is also invoked for P1 and it will fail since P1 is not a regular jar/war module.

<!-- This profile handles generation of jar/war artifacts to be used in executing tests in a web-container
       -->
       <profile>
           <id>webapp</id>
           <activation>
               <activeByDefault>false</activeByDefault>
           </activation>

           <build>
               <plugins>
                   <!-- Create jar containing the jUnit tests -->
                   <plugin>
                       <groupId>org.apache.maven.plugins</groupId>
                       <artifactId>maven-jar-plugin</artifactId>
                       <version>2.2</version>
                       <executions>
                           <execution>
                               <configuration>
                                   <finalName>junit</finalName>
                               </configuration>
                               <phase>test</phase>
                               <goals>
                                   <goal>test-jar</goal>
                               </goals>
                           </execution>
                       </executions>
                   </plugin>

                   <!-- Create war and include jUnit test jar -->
                   <plugin>
                       <groupId>org.apache.maven.plugins</groupId>
                       <artifactId>maven-war-plugin</artifactId>
                       <version>2.0.2</version>
                       <configuration>
                           <webResources>
                               <resource>
<!-- this is relative to the pom.xml directory -->
                                   
<directory>${project.build.directory}</directory>
                                   <includes>
                                       <include>*-tests.jar</include>
                                   </includes>
                                   <targetPath>WEB-INF/test-lib</targetPath>
                               </resource>
                           </webResources>
                       </configuration>
                       <executions>
                           <execution>
                               <phase>package</phase>
                               <goals>
                                   <goal>war</goal>
                               </goals>
                           </execution>
                       </executions>
                   </plugin>
               </plugins>
           </build>
       </profile>

How do we prevent the plugin from being invoked if the packaging is "pom"? Is it the responsibility of the individual plugin?

Thanks,
Raymond



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to