Maven + App Engine + Google Eclipse Plugin

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

Upvotes: 19

Views: 13263

Answers (5)

Maciej
Maciej

Reputation: 31

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.

Upvotes: 0

Maciej
Maciej

Reputation: 31

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>

Upvotes: 1

Michele Orsi
Michele Orsi

Reputation: 762

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

Upvotes: 3

Travis Webb
Travis Webb

Reputation: 15018

+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.

Upvotes: 2

Rick Mangi
Rick Mangi

Reputation: 3769

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.

Upvotes: 6

Related Questions