You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Raymond Feng <en...@gmail.com> on 2008/02/06 00:07:20 UTC

How to prevent a plugin from being invoked for the pom project?

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: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org