Maven + App Engine + Google Eclipse插件

时间:2012-04-13 18:07:20

标签: google-app-engine maven google-eclipse-plugin

我有没有办法让Maven兼容的Google App Engine(Java)项目与Eclipse内的Google Eclipse插件兼容?

谢谢!

修改

现在支持Maven插件:

https://developers.google.com/appengine/docs/java/tools/maven

5 个答案:

答案 0 :(得分:6)

取决于“兼容”的含义,这取决于您使用GAE插件的功能。我们使用appengine maven插件http://code.google.com/p/maven-gae-plugin/和eclipse,他们似乎一起工作,但我们没有使用GWT或JDO。和maven / eclipse这样的大多数事情一样,我发现最好从命令行运行你的东西,然后使用eclipse作为编辑器。

答案 1 :(得分:3)

我使用maven和GAE,因为JDO一年没问题。 这是我在MacOSX Snow Leopard上的配置:

  • Apache Maven 3.0.3
  • Eclipse版本:3.7.1
  • m2e - Eclipse 1.0.100.20110804-1717的Maven Integration

将Eclipse与Maven完全集成(从命令行“mvn test”和Eclipse中的JUnit接口运行所有测试)的一个重要事情是以这种方式获得.project文件:

<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
    <name>PROJECT_NAME</name>
    <comment></comment>
    <projects>
    </projects>
    <buildSpec>
        <buildCommand>
            <name>org.eclipse.jdt.core.javabuilder</name>
            <arguments>
            </arguments>
        </buildCommand>
        <buildCommand>
            <name>org.eclipse.m2e.core.maven2Builder</name>
            <arguments>
            </arguments>
        </buildCommand>
    </buildSpec>
    <natures>
        <nature>org.eclipse.m2e.core.maven2Nature</nature>
        <nature>org.eclipse.jdt.core.javanature</nature>
    </natures>
</projectDescription>

该插件已移至此处: https://github.com/maven-gae-plugin/maven-gae-plugin

答案 2 :(得分:2)

+1给Rick的答案,但我想补充一下:

Google有一个关于此的教程:http://code.google.com/p/google-web-toolkit/wiki/WorkingWithMaven

那就是说,我们从来没有让它100%工作。 maven-gwt-plugin似乎与Eclipse存在问题,如果由于APT而使用RequestFactory会变得更糟。 maven-gae-plugin似乎发挥得很好。从cmdline运行更容易。此外,Eclipse 3.7 / m2e中存在一个已知的错误[需要引用],可以防止很多事情正常工作。

答案 3 :(得分:1)

如上所述谷歌提供了对maven的支持: https://developers.google.com/appengine/docs/java/tools/maven

但看起来它并不能完全与Eclipse一起工作(如评论中所述:“SDK位置'.m2 \ repository \ com \ google \ appengine \ appengine-api-1.0-sdk \ 1.7.2 \ appengine- api-1.0-sdk-1.7.2.jar'不是目录“)

要解决它我已经使用了maven-eclipse-plugin,并为GAE / JRE指定了容器:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-eclipse-plugin</artifactId>
    <version>2.9</version>
    <configuration>
    <classpathContainers>              
<classpathContainer>org.eclipse.jdt.launching.JRE_CONTAINER</classpathContainer>
<classpathContainer>com.google.appengine.eclipse.core.GAE_CONTAINER</classpathContainer>
    </classpathContainers>
    </configuration>
</plugin>

答案 4 :(得分:0)

我对GAE + Maven + Eclipse的一般发现。

规则1:使用GAE原型生成GAE项目:https://developers.google.com/appengine/docs/java/tools/maven

规则2:如果你想用Eclipse开发 - 不要做“mvn eclipse:eclipse”然后导入 - 它会导致很多问题。而是导入为“Maven Project”

规则3:简单/工作解决方案如何创建YouTube上描述的MVN / GAE / Eclipse项目 http://www.youtube.com/watch?v=oC6bJp5X3LI

PS。我正在使用单独的Web / DAO / Domain模块进行项目 - 稍后我会发布我的发现和线索。