google-app-enginemaven-war-pluginappengine-maven-plugin

appengine-maven-plugin has a maven-war-plugin in the background? it gets called twice if I define on my own


I have tried a lot of things, and it seems that my project executes "maven-war-plugin" twice.

Because of this I can't run optimizations like merging all the classes into a single jar (using maven shade plugin).

I am pretty sure that the appengine-maven-plugin is calling the maven-war-plugin to create the appengine packaging. I know that because I tried removing my own definitition of "maven-war-plugin" and it's still execute "magically". Does it makes any sense to be in that way?

My pom.xml is:

 <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.3</version>
            <executions>
              <execution>
                <phase>package</phase>
                <goals>
                  <goal>war</goal>
                </goals>
              </execution>
            </executions>
            <configuration>
                <webResources>
                    <!-- in order to interpolate version from pom into appengine-web.xml -->
                    <resource>
                        <directory>${basedir}/src/main/webapp/WEB-INF</directory>
                        <filtering>true</filtering>
                        <excludes>
                            <exclude>**/*.jar</exclude>
                        </excludes>
                        <targetPath>WEB-INF</targetPath>
                    </resource>
                </webResources>
            </configuration>
        </plugin>   

        <plugin>
            <groupId>com.google.appengine</groupId>
            <artifactId>appengine-maven-plugin</artifactId>
            <version>${appengine.target.version}</version>                              
            <configuration>     
                <useJava7>true</useJava7>
                <address>0.0.0.0</address>
                <port>8080</port>
                <compileEncoding>utf-8</compileEncoding>

                <jvmFlags>
                    <jvmFlag>-XX:-UseSplitVerifier</jvmFlag>
                    <jvmFlag>-Xms512m</jvmFlag>
                    <jvmFlag>-Xmx2048m</jvmFlag>
                    <jvmFlag>-XX:NewSize=256m</jvmFlag>
                    <jvmFlag>-XX:MaxNewSize=256m</jvmFlag>
                    <jvmFlag>-XX:PermSize=512m</jvmFlag>
                    <jvmFlag>-XX:MaxPermSize=768m</jvmFlag>
                    <jvmFlag>-Xdebug</jvmFlag>
                    <jvmFlag>-agentlib:jdwp=transport=dt_socket,address=31337,server=y,suspend=n</jvmFlag>
                </jvmFlags>                
            </configuration>
        </plugin>

Solution

  • It looks like you are explicitly running the war plugin twice, you have another execution declared in the executions section for that plugin. The appengine-maven-plugin just declares that package phase must have completed. It doesn't care what happens during packaging.

    Here is a good example of how to do this.

    I hope this helps.