我对 GWT(Google Web ToolKit)、GAE(Google App Engine)堆栈非常陌生。我需要编写此应用程序并将其上传到 GAE。
该项目使用 maven 作为构建和部署管理工具。
这是问题:
1)我将项目作为Maven项目导入我的eclipse(Eclipse配备了m2e eclipse插件,gwt和gae插件)
2) 默认情况下,GAE 特性是关闭的,所以当我将它作为 GWT Web 应用程序运行时,它运行良好。
3)当我打开GAE功能使用eclipse将其部署到GAE时,它会抛出App Engine SDK is not a valid directory的错误,因为maven认为jar是SDK home(我知道这很愚蠢)这在这个StackOverFlow 问题中得到了解决。
Java Build Path
4)解决方案有效,当我移动库选项卡底部的 Maven 依赖项时,我能够摆脱这个错误。
5)问题是:这搞砸了 Maven 一开始要加载的其他依赖项(如 Spring 的ContextLoaderListener
),并为这个类抛出一个ClassNotFound
。此外,我觉得它也会给我其他例外,因为我将 Maven 依赖项移到了底部。
这是我的 pom 文件的相关部分:
<?xml version="1.0" encoding="UTF-8"?>
<properties>
<!-- client -->
<!-- Get the latest GXT release through support 3.0.6... -->
<gxt.version>3.0.1</gxt.version>
<gwt.version>2.5.1</gwt.version>
<gwtp.version>1.0</gwtp.version>
<gin.version>2.0.0</gin.version>
<gwtquery.version>1.3.2</gwtquery.version>
<!-- server -->
<guice.version>3.0</guice.version>
<mysql.version>5.1.26</mysql.version>
<spring.version>3.2.4.RELEASE</spring.version>
<!-- testing -->
<junit.version>4.11</junit.version>
<jukito.version>1.1</jukito.version>
<!-- maven -->
<gwt-maven-plugin.version>2.5.1</gwt-maven-plugin.version>
<maven-surefire-plugin.version>2.6</maven-surefire-plugin.version>
<maven-compiler-plugin.version>2.3.2</maven-compiler-plugin.version>
<maven-resources-plugin.version>2.5</maven-resources-plugin.version>
<maven-processor-plugin.version>2.0.5</maven-processor-plugin.version>
<maven-build-helper-plugin.version>1.7</maven-build-helper-plugin.version>
<target.jdk>1.6</target.jdk>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<!-- REST -->
<resteasy.version>3.0.2.Final</resteasy.version>
<arcbees.version>1.1.1</arcbees.version>
<!-- GAE -->
<gae.version>1.8.4</gae.version>
<gae.home>${settings.localRepository}/com/google/appengine/appengine-java-
sdk/${gae.version}/appengine-java-sdk-${gae.version}</gae.home>
<webappDirectory>${project.build.directory}/${project.build.finalName}
</webappDirectory>
</properties>
<build>
<outputDirectory>${webappDirectory}/WEB-INF/classes</outputDirectory>
<plugins>
<plugin>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-maven-plugin</artifactId>
<version>${gae.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<source>${target.jdk}</source>
<target>${target.jdk}</target>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>${gwt.version}</version>
<configuration>
<gwtSdkFirstInClasspath>true</gwtSdkFirstInClasspath>
<strict>true</strict>
<testTimeOut>180</testTimeOut>
<includes>**/*GwtTestSuite.java</includes>
<excludes>**/*GwtTest.java</excludes>
<mode>htmlunit</mode>
<extraJvmArgs>-Xss1024K -Xmx1024M -XX:MaxPermSize=256M</extraJvmArgs>
<logLevel>INFO</logLevel>
<style>${gwt.style}</style>
<copyWebapp>true</copyWebapp>
<hostedWebapp>${webappDirectory}</hostedWebapp>
<runTarget>Sample.html</runTarget>
<modules>
<module>com.sample.Sample</module>
</modules>
</configuration>
<executions>
<execution>
<goals>
<goal>test</goal>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-api-1.0-sdk</artifactId>
<version>${gae.version}</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<!-- GXT -->
<!-- http://docs.sencha.com/gxt-guides/3/ -->
<dependency>
<groupId>com.sencha.gxt</groupId>
<artifactId>gxt</artifactId>
<version>${gxt.version}</version>
</dependency>
<dependency>
<groupId>com.sencha.gxt</groupId>
<artifactId>gxt-chart</artifactId>
<version>${gxt.version}</version>
</dependency>
<!-- Google Web Toolkit -->
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>${gwt.version}</version>
</dependency>
<!-- GWT-Platform -->
<dependency>
<groupId>com.gwtplatform</groupId>
<artifactId>gwtp-mvp-client</artifactId>
<version>${gwtp.version}</version>
</dependency>
<dependency>
<groupId>com.gwtplatform</groupId>
<artifactId>gwtp-dispatch-client</artifactId>
<version>${gwtp.version}</version>
</dependency>
<dependency>
<groupId>com.gwtplatform</groupId>
<artifactId>gwtp-dispatch-server-guice</artifactId>
<version>${gwtp.version}</version>
</dependency>
<dependency>
<groupId>com.gwtplatform</groupId>
<artifactId>gwtp-dispatch-rest</artifactId>
<version>${gwtp.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.gwtplatform</groupId>
<artifactId>gwtp-dispatch-shared</artifactId>
<version>${gwtp.version}</version>
</dependency>
<!-- DI -->
<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
<version>${guice.version}</version>
</dependency>
<dependency>
<groupId>com.google.inject.extensions</groupId>
<artifactId>guice-servlet</artifactId>
<version>${guice.version}</version>
</dependency>
<dependency>
<groupId>com.google.inject.extensions</groupId>
<artifactId>guice-assistedinject</artifactId>
<version>${guice.version}</version>
</dependency>
<dependency>
<groupId>com.google.gwt.inject</groupId>
<artifactId>gin</artifactId>
<version>${gin.version}</version>
</dependency>
<dependency>
<groupId>com.googlecode.gwtquery</groupId>
<artifactId>gwtquery</artifactId>
<version>${gwtquery.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.arcbees</groupId>
<artifactId>guicy-resteasy</artifactId>
<version>${arcbees.version}</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${mysql.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aspects</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${spring.version}</version>
</dependency>
</project>
有人可以提出解决此问题的方法吗?
感谢您阅读到最后。