Maven + App Engine + Google Eclipse Plugin - google-app-engine

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

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.

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

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

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>

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.

Related

Need help Migrating from legacy SDK (appcfg)

Google has emailed me saying "Migrate your App Engine projects from the legacy SDK (appcfg)" for 3 of my projects. I don't use appcfg, I use mvn to deploy my software. I've 6 projects in total on GAE and have compared the pom files and build files and they are identical. I thought it was because I'm using an older appengine-api, but they are fairly up to date and all use the same version:
<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-api-1.0-sdk</artifactId>
<version>1.9.58</version>
</dependency>
What I am missing here?
Thanks
Tim
So you basically want to know why would Google send you that email if your projects do not use appcfg?. It could be because:
1.- Just a reminder that you should migrate to the new SDK. If is not specified on the email something like "we have noticed that your project --- is using ..." then is probably just a general reminder.
2.- You have previous versions where you used the legacy SDK, and Google is detecting this.
3.- You are using a deprecated version of Java App Engine SDK-based plugin and have to migrate to the new version (less likely but since you are in fact using Maven wouldn't hurt to check).
Also, i know that you said you weren't using appcfg but here's a list of equivalents commands between appcfg and gcloud for extra information.

Fail to deploy application to appengine

Execution default-cli of goal com.google.cloud.tools:appengine-maven-plugin:1.3.2:deploy
failed: Validation Error: Java App Engine components not installed.
Fix by running 'gcloud components install app-engine-java' on command-line.
I already install the latest app-engine-java and google cloud SDK
And i also reinstalled cloud Sdk, that is not working for me.
below is my pom.xml
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>appengine-maven-plugin</artifactId>
<version>1.3.2</version>
<configuration>
<stage.enableJarSplitting>true</stage.enableJarSplitting>
<deploy.stopPreviousVersion>true</deploy.stopPreviousVersion>
<cloudSdkPath>/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk</cloudSdkPath>
</configuration>
As you use Java and App Engine I recommend you to take a look to this official documentation in order to install the required SDK and configure your develop environment with the necessary tools for the purpose of deploy successfully your app.
Let me know how it goes.

Google Endpoints V2 and Maven plugin version?

We have a multi-module (war-packaged) project that uses com.google.appengine - appengine-maven-plugin target being ear file.
We have migrated succesfully to Java8 and EndpointsV2. It builds and runs fine in Cloud. However the following requirement is still a bit questionmark in the migration instructions. What is the reason behind this incompatibility and requirement? Or is it just related to for example "discovery docs" that we are not using anyway?
The old App Engine Maven plugin, with group com.google.appengine, is incompatible with the Endpoints Framework plugin. You must use the new version shown above
https://cloud.google.com/endpoints/docs/frameworks/java/migrating
If you aren't using discovery docs or generated client libraries and are only using Endpoints as a library dependency, you can remove the Endpoints plugin and the error should go away.

Is there a mandatory requirement to switch app.yaml?

Folks,
I'm using the recently released Google Cloud SDK 0.9.56 on Windows 7x64.
When trying to gcloud deploy my app using web.xml and appengine-web.xml, I get a response:
ERROR: Found no valid App Engine configuration files in directory
When trying to do the same with apps defined with app.yaml there were no issues.
Teammates with older SDK versions don't seem to have an issue.
Is there a mandatory requirement to use app.yaml in all apps?
P.S: This question might be related but its actually a different issue.
sorry about this.
That question you linked is actually the same issue. You can use the new maven plugin described there to translate your appengine-web.xml to app.yaml automatically. We have a gradle plugin coming out very soon to do the same thing.
If you'd like to keep using gcloud directly without Maven or Gradle, you'll need to translate the appengine-web.xml to an app.yaml for now.
Let me know if I can help.

Using Maven in Google App Engine application

I'm making Google App Engine project with SpringSource Tool Suite. I made project without maven and added libraries to lib folder and I got Spring Framework work perfectly. But the I tried to make project that uses Maven, adn I when I tried to run my app on development server it cannot find any classes.
So what should I do, so that my dependecies are actually deployed to lib folder?
Example of dependency in pom.xml:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>org.springframework.core</artifactId>
<version>3.0.2.RELEASE</version>
</dependency>
Take a look at the pom.xml in my jappstart project. It's a functional GAE project that uses Spring.
Take a look at the example it covers Sprint 3, Google App Engine and maven.

Resources