2011-10-26 71 views
7

我正在尋找關於如何「mavenize」由Google Eclipse Plugin創建的Google AppEngine項目的基本教程。Maven + GAE步驟

如果太困難了,如何創建一個Maven項目,添加GAE支持,然後將其導入到Eclipse中,並從那裏使用GooglePlugin?

P.s.如果我也想要SpringMVC呢?

回答

4

我不知道如何從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

產生月食配置

開發服務器可以通過mvn gae:run啓動,部署在mvn gae:deploy

使用Spring,添加依賴於文物spring-webmvcspring-corespring-context下組org.springframework

+0

那是什麼? –

+0

當我鍵入'gae:deploy'時,我收到一條消息,指出我的身份驗證憑據無法找到。你能解釋一下我需要設置它們嗎?我已經登錄到Google Eclipse插件。 – lanoxx

+0

另外eclipse正在抱怨gae插件執行沒有被發現,我該如何解決這個問題? – lanoxx