How to Add Google App Engine Endpoints support to your Maven project

First create a normal Google App Engine project.

Then add endpoint support with this dependency:

<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-endpoints</artifactId>
<version>${appengine.target.version}</version>
</dependency>

Change pom.xml to add the endpoint discovery support to the appengine-maven-plugin and modify the war plugin so each time the WAR plugin executes the endpoints_get_discovery_doc goal will also be executed.  Your endpoints will then be available when deploying.

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<configuration>
<webXml>${project.build.directory}/generated-sources/appengine-endpoints/WEB-INF/web.xml</webXml>
<webResources>
<resource>
<directory>${basedir}/src/main/webapp/WEB-INF/</directory>
<filtering>true</filtering>
<targetPath>WEB-INF</targetPath>
<excludes>
<exclude>web.xml</exclude>
</excludes>
</resource>
<resource>
<directory>${project.build.directory}/generated-sources/appengine-endpoints</directory>
<includes>
<include>WEB-INF/*.discovery</include>
<include>WEB-INF/*.api</include>
</includes>
<filtering>true</filtering>
</resource>
</webResources>
</configuration>
</plugin>
<plugin>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-maven-plugin</artifactId>
<version>${appengine.target.version}</version>
<configuration>
<enableJarClasses>false</enableJarClasses>
<oauth2>false</oauth2>
</configuration>
<executions>
<execution>
<goals>
<goal>endpoints_get_discovery_doc</goal>
</goals>
</execution>
</executions>
</plugin>

run maven goal: 
appengine:endpoints_get_client_lib
appengine:devserver

**********************

Comments

Popular posts from this blog

Check MySQL query history from command line