【发布时间】:2011-12-15 16:43:58
【问题描述】:
我正在寻找有关如何“mavenize”由 Google Eclipse 插件创建的 Google AppEngine 项目的基本教程。
如果这太难了,如何创建一个 Maven 项目,为其添加 GAE 支持,然后将其导入 Eclipse 并从那里使用 GooglePlugin?
附:如果我也想要 SpringMVC 怎么办?
【问题讨论】:
标签: java eclipse google-app-engine maven
我正在寻找有关如何“mavenize”由 Google Eclipse 插件创建的 Google AppEngine 项目的基本教程。
如果这太难了,如何创建一个 Maven 项目,为其添加 GAE 支持,然后将其导入 Eclipse 并从那里使用 GooglePlugin?
附:如果我也想要 SpringMVC 怎么办?
【问题讨论】:
标签: java eclipse google-app-engine maven
我不确定如何从 Eclipse 创建 maven 项目,但是从头开始创建它非常容易。对于 gae,您可以使用net.kindleit:maven-gae-plugin 参见http://www.kindleit.net/maven_gae_plugin/index.html,它可以为您生成pom.xml。或者只是将其用作
<plugin>
<groupId>net.kindleit</groupId>
<artifactId>maven-gae-plugin</artifactId>
<version>0.8.4</version>
<configuration>
<port>8080</port>
<address>127.0.0.1</address>
</configuration>
<executions>
<execution>
<id>start-gae</id>
<goals>
<goal>stop</goal>
<goal>unpack</goal>
<goal>start</goal>
</goals>
</execution>
<execution>
<id>stop-gae</id>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
但不要忘记添加 GAE 依赖项:
<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-api-1.0-sdk</artifactId>
<version>${gae.version}</version>
</dependency>
<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-api-labs</artifactId>
<version>${gae.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-api-stubs</artifactId>
<version>${gae.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-testing</artifactId>
<version>${gae.version}</version>
<scope>test</scope>
</dependency>
和存储库:
<pluginRepositories>
<pluginRepository>
<id>maven-gae-plugin-repo</id>
<name>maven-gae-plugin repository</name>
<url>http://maven-gae-plugin.googlecode.com/svn/repository</url>
</pluginRepository>
</pluginRepositories>
<repositories>
<repository>
<id>maven-gae-plugin-repo</id>
<name>maven-gae-plugin repository</name>
<url>http://maven-gae-plugin.googlecode.com/svn/repository</url>
</repository>
</repositories>
然后你可以使用mvn eclipse:eclipse生成eclipse配置
开发服务器可以mvn gae:run启动,mvn gae:deploy部署
要使用 Spring,将依赖项添加到 spring-webmvc、spring-core 和 spring-context 组 org.springframework 下的工件
【讨论】:
gae:deploy 时,我收到一条消息,提示我找不到我的身份验证凭据。你能解释一下我需要在哪里设置它们吗?我已经登录了 Google Eclipse 插件。