Table Of Contents
GOAL
The main goal of this article is to give a complete example in order to develop a complete GWT application , using JSP,JSTL,JPA,GWT-RPC .... , and deploy it on Google App Engine using maven version either 2 or 3
POM
Dependencies
dependencies
<properties> <gae.version>1.3.2</gae.version> <gae.sdk.version>1.3.8</gae.sdk.version> <datanucleus-jpa.version>2.1.3</datanucleus-jpa.version> <project_charset>UTF-8</project_charset> <gwt.version>2.1.0</gwt.version> </properties> <dependencies> <!-- =========================================== TEST DEPS =========================================== --> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.8.2</version> <scope>test</scope> </dependency> <!-- =========================================== GAE-API-1.0 DEPS =========================================== --> <dependency> <groupId>com.google.appengine</groupId> <artifactId>appengine-api-1.0-labs</artifactId> <version>${gae.version}</version> <scope>test</scope> </dependency> <dependency> <groupId>com.google.appengine</groupId> <artifactId>appengine-api-1.0-stubs</artifactId> <version>${gae.version}</version> <scope>test</scope> </dependency> <dependency> <groupId>com.google.appengine</groupId> <artifactId>appengine-api-1.0-runtime</artifactId> <version>${gae.version}</version> <scope>test</scope> </dependency> <!-- =========================================== GAE-SDK DEPS =========================================== --> <dependency> <groupId>com.google.appengine</groupId> <artifactId>appengine-tools-sdk</artifactId> <version>${gae.sdk.version}</version> <scope>test</scope> </dependency> <dependency> <groupId>com.google.appengine</groupId> <artifactId>appengine-api-1.0-sdk</artifactId> <version>${gae.sdk.version}</version> <scope>runtime</scope> </dependency> <!-- ======================= DATANUCLEUS ======================= --> <dependency> <groupId>com.google.appengine.orm</groupId> <artifactId>datanucleus-appengine</artifactId> <version>1.0.7</version> </dependency> <dependency> <groupId>org.apache.geronimo.specs</groupId> <artifactId>geronimo-jta_1.1_spec</artifactId> <version>1.1.1</version> </dependency> <dependency> <groupId>org.apache.geronimo.specs</groupId> <artifactId>geronimo-jpa_3.0_spec</artifactId> <version>1.1.1</version> </dependency> <dependency> <groupId>javax.jdo</groupId> <artifactId>jdo2-api</artifactId> <version>2.3-eb</version> </dependency> <dependency> <groupId>org.datanucleus</groupId> <artifactId>datanucleus-core</artifactId> <version>2.2.0-m3</version> </dependency> <dependency> <groupId>org.datanucleus</groupId> <artifactId>datanucleus-jpa</artifactId> <version>${datanucleus-jpa.version}</version> </dependency> <!-- ======================= SERVLET,JSP,JSTL ======================= --> <dependency> <groupId>javax.servlet</groupId> <artifactId>servlet-api</artifactId> <version>2.5</version> <scope>provided</scope> </dependency> <dependency> <groupId>javax.servlet</groupId> <artifactId>jsp-api</artifactId> <version>2.0</version> <scope>provided</scope> </dependency> <dependency> <groupId>javax.servlet</groupId> <artifactId>jstl</artifactId> <version>1.1.2</version> </dependency> <dependency> <groupId>taglibs</groupId> <artifactId>standard</artifactId> <version>1.1.2</version> </dependency> <!-- ==================================================== GWT DEPS ==================================================== --> <dependency> <groupId>com.google.gwt</groupId> <artifactId>gwt-servlet</artifactId> <version>${gwt.version}</version> <scope>runtime</scope> </dependency> <dependency> <groupId>com.google.gwt</groupId> <artifactId>gwt-user</artifactId> <version>${gwt.version}</version> <scope>provided</scope> </dependency> <!-- ==================================================== JAKARTA COMMONS DEPS ==================================================== --> <dependency> <groupId>commons-fileupload</groupId> <artifactId>commons-fileupload</artifactId> <version>1.2.1</version> </dependency> <dependency> <groupId>commons-io</groupId> <artifactId>commons-io</artifactId> <version>1.4</version> </dependency> <dependency> <groupId>commons-lang</groupId> <artifactId>commons-lang</artifactId> <version>2.4</version> </dependency> <dependency> <groupId>commons-logging</groupId> <artifactId>commons-logging</artifactId> <version>1.1.1</version> <exclusions> <exclusion> <groupId>log4j</groupId> <artifactId>log4j</artifactId> </exclusion> <exclusion> <groupId>logkit</groupId> <artifactId>logkit</artifactId> </exclusion> <exclusion> <groupId>avalon-framework</groupId> <artifactId>avalon-framework</artifactId> </exclusion> </exclusions> </dependency> <!-- ==================================================== SPRING DEPS ==================================================== --> <!-- <dependency> <groupId>org.springframework</groupId> <artifactId>spring-core</artifactId> <version>2.5.6</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-web</artifactId> <version>2.5.6</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-orm</artifactId> <version>2.5.6</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-aop</artifactId> <version>2.5.6</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-jpa</artifactId> <version>2.0.8</version> <exclusions> <exclusion> <groupId>org.springframework</groupId> <artifactId>spring-core</artifactId> </exclusion> <exclusion> <groupId>org.springframework</groupId> <artifactId>spring-beans</artifactId> </exclusion> <exclusion> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> </exclusion> <exclusion> <groupId>org.springframework</groupId> <artifactId>spring-web</artifactId> </exclusion> <exclusion> <groupId>org.springframework</groupId> <artifactId>spring-jdbc</artifactId> </exclusion> <exclusion> <groupId>org.springframework</groupId> <artifactId>spring-web</artifactId> </exclusion> </exclusions> </dependency> --> <!-- ==================================================== STRUTS2 DEPS ==================================================== --> <!-- <dependency> <groupId>org.apache.struts</groupId> <artifactId>struts2-core</artifactId> <version>2.1.8.1</version> </dependency> <dependency> <groupId>com.opensymphony</groupId> <artifactId>xwork</artifactId> <version>2.1.2</version> <exclusions> <exclusion> <groupId>org.springframework</groupId> <artifactId>spring-test</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.apache.struts</groupId> <artifactId>struts2-spring-plugin</artifactId> <version>2.1.8.1</version> <exclusions> <exclusion> <groupId>org.springframework</groupId> <artifactId>spring-beans</artifactId> </exclusion> <exclusion> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> </exclusion> <exclusion> <groupId>org.springframework</groupId> <artifactId>spring-core</artifactId> </exclusion> <exclusion> <groupId>org.springframework</groupId> <artifactId>spring-web</artifactId> </exclusion> </exclusions> </dependency> --> <!-- ==================================================== CUSTOM DEPS ==================================================== --> </dependencies>
Plugins
plugins
<plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>2.0.2</version> <configuration> <source>1.5</source> <target>1.5</target> </configuration> </plugin> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>gwt-maven-plugin</artifactId> <version>2.1.0</version> <dependencies> </dependencies> <configuration> <runTarget>it.softphone.rpt.Application/Application.html</runTarget> <hostedWebapp>${project.build.directory}/${project.build.finalName}</hostedWebapp> </configuration> <executions> <execution> <goals> <goal>compile</goal> <goal>generateAsync</goal> <!-- goal>test</goal --> </goals> </execution> </executions> </plugin> <plugin> <groupId>org.datanucleus</groupId> <artifactId>maven-datanucleus-plugin</artifactId> <version>2.2.0-release</version> <dependencies> <dependency> <groupId>org.datanucleus</groupId> <artifactId>datanucleus-jpa</artifactId> <version>${datanucleus-jpa.version}</version> </dependency> </dependencies> <configuration> <mappingIncludes>**/*.class</mappingIncludes> <verbose>true</verbose> <enhancerName>ASM</enhancerName> <api>JPA</api> </configuration> <executions> <execution> <phase>compile</phase> <goals> <goal>enhance</goal> </goals> </execution> </executions> </plugin> <!-- <plugin> <groupId>org.datanucleus</groupId> <artifactId>maven-datanucleus-plugin</artifactId> <version>2.2.0-release</version> <configuration> <mappingIncludes>**/Snippet.class</mappingIncludes> <verbose>true</verbose> <enhancerName>ASM</enhancerName> <api>JDO</api> </configuration> <executions> <execution> <phase>compile</phase> <goals> <goal>enhance</goal> </goals> </execution> </executions> <dependencies> <dependency> <groupId>org.datanucleus</groupId> <artifactId>datanucleus-core</artifactId> <version>1.1.5</version> <exclusions> <exclusion> <groupId>javax.transaction</groupId> <artifactId>transaction-api</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.datanucleus</groupId> <artifactId>datanucleus-rdbms</artifactId> <version>1.1.5</version> </dependency> <dependency> <groupId>org.datanucleus</groupId> <artifactId>datanucleus-enhancer</artifactId> <version>1.1.4</version> </dependency> </dependencies> </plugin> --> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.3</version> <configuration> <skip>true</skip> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-site-plugin</artifactId> <version>2.0-beta-5</version> <configuration> <outputEncoding>${project_charset}</outputEncoding> <inputEncoding>${project_charset}</inputEncoding> </configuration> </plugin> <plugin> <groupId>net.kindleit</groupId> <artifactId>maven-gae-plugin</artifactId> <version>0.7.2</version> <configuration> <port>81</port> <splitJars>true</splitJars> </configuration> </plugin> </plugins>
Repositories
repositories
<repositories> <repository> <id>mvnsearch</id> <url>http://www.mvnsearch.org/maven2</url> </repository> <repository> <id>datanucleus</id> <url>http://www.datanucleus.org/downloads/maven2</url> </repository> <repository> <id>gae-plugin</id> <url>http://maven-gae-plugin.googlecode.com/svn/repository</url> </repository> </repositories> <pluginRepositories> <pluginRepository> <id>datanucleus</id> <url>http://www.datanucleus.org/downloads/maven2</url> </pluginRepository> <pluginRepository> <id>gae-plugin</id> <url>http://maven-gae-plugin.googlecode.com/svn/repository</url> </pluginRepository> <pluginRepository> <id>mvnsearch</id> <url>http://www.mvnsearch.org/maven2</url> </pluginRepository> </pluginRepositories>