19

Is there a way I can have a Maven compatible Google App Engine (Java) project that is also compatible with the Google Eclipse Plugin inside Eclipse?

Thanks!

EDIT:

Native support for a Maven plugin now:

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

5 Answers5

6

Depends on what you mean by "compatible" and it depends on what features you're using of GAE plugin. We use the appengine maven plugin http://code.google.com/p/maven-gae-plugin/ and eclipse and they seem to work fine together but we're not using GWT or JDO. As with most things maven/eclipse I find it's best to run your stuff from the command line and just use eclipse as an editor.

Rick Mangi
  • 3,681
  • 1
  • 11
  • 16
  • 1
    I want to be able to use all the GAE features of the Google Eclipse Plugin while being able to use the dependency/tests/deployment features of Maven. Like having the app engine sdk linked by Maven etc. I want to integrate my project into Jenkins. Thanks! – Mike Gleason jr Couturier Apr 13 '12 at 18:33
  • Also, I'm not using any particular framework of tools like GWT/JDO :) – Mike Gleason jr Couturier Apr 13 '12 at 18:35
  • 1
    Yes, all of that works. But you may need to manually edit your GAE Plugin settings (in the project config in eclipse) to use the ~/.m2/repository/.... for your GAE SDK. Look at the docs, make sure you also set the config to point to your war in /src/webapp. – Rick Mangi Apr 13 '12 at 18:38
  • 1
    I keep getting this error: "SDK location '\.m2\repository\com\google\appengine\appengine-api-1.0-sdk\1.7.2\appengine-api-1.0-sdk-1.7.2.jar' is not a directory". I've already pushed the Maven dependencies to the bottom of the classpath without result. Anyone seen this? thx – ZiglioUK Sep 23 '12 at 08:29
  • Is it a directory? Do you have a settings.xml file defined? If you do you might be pointing at the wrong location. That directory should be in your home directory (on unix ~/.m2/repository) – Rick Mangi Sep 24 '12 at 20:20
3

I use maven and GAE since one year with JDO with no problems. Here is my configuration on MacOSX Snow Leopard:

  • Apache Maven 3.0.3
  • Eclipse Version: 3.7.1
  • m2e - Maven Integration for Eclipse 1.0.100.20110804-1717

An important thing to have fully integrated Eclipse with Maven (run all the tests both from command line "mvn test" and from JUnit interface inside Eclipse) is to have the .project file in this way:

<?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>

The plugin has moved here: https://github.com/maven-gae-plugin/maven-gae-plugin

Michele Orsi
  • 744
  • 4
  • 15
2

+1 to Rick's answer, but I'd like to add this:

Google has a tutorial on this: http://code.google.com/p/google-web-toolkit/wiki/WorkingWithMaven

That said, we have never gotten it to work 100%. The maven-gwt-plugin seems to have problems with Eclipse, and it gets worse if you're using RequestFactory due to APT. maven-gae-plugin seems to play nicely. Running from cmdline is much easier. Further, there's a known bug[citation needed] in Eclipse 3.7/m2e that prevents a lot of things from working correctly.

Travis Webb
  • 13,507
  • 6
  • 51
  • 101
1

As mentioned google provided support for maven: https://developers.google.com/appengine/docs/java/tools/maven

But looks it doesn't work fully with Eclipse (as mentioned in one of comments: "SDK location '.m2\repository\com\google\appengine\appengine-api-1.0-sdk\1.7.2\appengine-api-‌​1.0-sdk-1.7.2.jar' is not a directory")

To resolve it I've used maven-eclipse-plugin, and specified containers for 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>
Maciej
  • 31
  • 2
0

My general findings about GAE + Maven + Eclipse.

Rule no 1: Use GAE archetype to generate your GAE project: https://developers.google.com/appengine/docs/java/tools/maven

Rule no 2: If you want to develop with Eclipse - don't do "mvn eclipse:eclipse" and then import - it will cause a lot of problems. Instead import as "Maven Project"

Rule no 3: Simple / working solution how to create MVN/GAE/Eclipse project described on YouTube http://www.youtube.com/watch?v=oC6bJp5X3LI

PS. I'm working on project with separate Web/DAO/Domain modules - I will post later my findings and clues.

Maciej
  • 31
  • 2