1

I've a appengine maven project which uses the newly recommended module structure. So I've a ear module which in turn contains 2 war sub modules. I'm using run mvn appengine:devserver from ear directory to run the code. I want maven to deploy any code change as soon as I save it so I can refresh the browser and see the changes but that doesn't seem to work. Here's my ear pom.

target/${project.artifactId}-${project.version}/*/WEB-INF/classes org.apache.maven.plugins maven-ear-plugin 2.8 5 lib war com.google.appengine appengine-maven-plugin ${appengine.target.version} 2

<dependencies>
    <dependency>
        <groupId>com.blah.app</groupId>
        <artifactId>A</artifactId>
        <version>1.0-SNAPSHOT</version>
        <type>war</type>
    </dependency>
    <dependency>
        <groupId>com.blah.backend</groupId>
        <artifactId>B</artifactId>
        <version>1.0-SNAPSHOT</version>
        <type>war</type>
    </dependency>
</dependencies>

Following the recommendation on https://developers.google.com/appengine/docs/java/tools/maven I've added in the buildOuputput directory under build directive and also specified

<configuration>
  <fullScanSeconds>2</fullScanSeconds>
</configuration>

under appengine-maven-plugin plugin. I've also enabled compile on save option in netbeans but maven doesn't seem to be scanning the classes folder and deploying the changes while devappserver is running.

Right now I'm stuck in clean build/deploy cycle for every small change. I'd really appreciate any help on this.

user1010373
  • 289
  • 1
  • 5
  • 12

1 Answers1

0

I managed to get it working in Eclipse by calling war:exploded from compile phase and adding a mapping in m2e configuration, so that it runs it in incremental builds in Eclipse. I am not sure how that would work in Netbeans, but maybe my solution for Eclipse will help you.

Here are the relevant portions of my pom:

This is the part that configures war:exploded execution:

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

This is the part configures m2e (it goes in the build section of pom.xml):

      <pluginManagement>
        <plugins>
            <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
            <plugin>
                <groupId>org.eclipse.m2e</groupId>
                <artifactId>lifecycle-mapping</artifactId>
                <version>1.0.0</version>
                <configuration>
                    <lifecycleMappingMetadata>
                        <pluginExecutions>
                            <pluginExecution>
                                <pluginExecutionFilter>
                                    <groupId>
                                        org.apache.maven.plugins
                                    </groupId>
                                    <artifactId>
                                        maven-war-plugin
                                    </artifactId>
                                    <versionRange>
                                        [2.4,)
                                    </versionRange>
                                    <goals>
                                        <goal>
                                            exploded
                                        </goal>
                                    </goals>
                                </pluginExecutionFilter>
                                <action>
                                    <execute>
                                        <runOnIncremental>true</runOnIncremental>
                                        <runOnConfiguration>true</runOnConfiguration>
                                    </execute>
                                </action>
                            </pluginExecution>
                        </pluginExecutions>
                    </lifecycleMappingMetadata>
                </configuration>
            </plugin>
        </plugins>
    </pluginManagement>
boyan
  • 41
  • 2