GAE + Eclipse + Maven – Update for Helios

Help me in making the integration of GAE, Eclipse and Maven smoother and star this issue in AppEngine

You may have noticed that Eclipse 3.6 aka Helios is out. That meant some changes on the m2eclipse plugin, mainly removal of the external tools Maven builder, which made the previous GAE + Eclipse + Maven configuration unusable.

Sounds horrible? It shouldn’t, since I’ve fixed the archetype and example project to be compatible with Helios. To create a new project just run:

mvn org.apache.maven.plugins:maven-archetype-plugin:2.0-alpha-4:generate \
  -DarchetypeGroupId=org.beardedgeeks \
  -DarchetypeArtifactId=gae-eclipse-maven-archetype \
  -DarchetypeVersion=1.3.2 \
  -DarchetypeRepository=http://beardedgeeks.googlecode.com/svn/repository/releases

If you already have a project and want to upgrade to Helios, change the contents of the content tag in the MavenBuilder to:

<![CDATA[<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.ui.externaltools.ProgramBuilderLaunchConfigurationType">
<stringAttribute key="org.eclipse.debug.core.ATTR_REFRESH_SCOPE" value="$${project}"/>
<booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${maven.home}/bin/${maven.executable}"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value="full,incremental,auto,"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS" value="war:exploded"/>
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${basedir}"/>
</launchConfiguration>]]>

And set up a the maven.executable property. By default it’s mvn and I created a build profile for Windows environments that sets it to mvn.bat.

With the new 1.3 version the linked war folder is no longer required. Even with an existing project I’d suggest you to check out the new configuration from the example. If you’re facing problems (or just want to praise me), go ahead and comment!

Update: Version 1.3.1 now has proper support for Windows!

Advertisement

11 Responses to “GAE + Eclipse + Maven – Update for Helios”


  1. 1 jordi August 13, 2010 at 00:54

    i was running crazy… many thanks for this, very helpful!

    cheers

  2. 2 mustafa January 20, 2011 at 01:46

    Hello, thanks for this. But I have a question,

    I dont understand windows Windows environments. Can you explain them as detail?

    • 3 hleinone January 20, 2011 at 01:53

      I don’t completely understand your question, but I assume it has something to do with Windows. So in the example POM we have a separate profile that adds .bat extension to the Maven executable path in the Eclipse configuration file. This has to be done since Windows can’t execute the mvn executable but has to instead use the mvn.bat.

      • 4 mustafa January 20, 2011 at 02:07

        I already have a project.(Ganymade), but I want to use eclipse Helios. My maven builder is not working. Update my .externalToolBuilders file as

        <launchConfiguration ……. but I have an error like that.->Reference to undefined variable maven.home. My Operation system windows xp, What must I define windows envirement. Variable name and variable value. I am new Eclipse and Maven, can you help me? thank you,

      • 5 hleinone January 20, 2011 at 02:22

        If it’s Eclipse complaining about the maven.home, you probably should re-run mvn eclipse:eclipse to regenerate the Eclipse project files. The maven.home should be then automatically replaced by the actual path to the Maven directory in your filesystem.

  3. 6 Luke August 6, 2011 at 16:40

    I’m confused about how this works in eclipse. It seems that the example project doesn’t have any settings to make use of google’s eclipse/app engine plugin.

  4. 8 jlreilly October 20, 2011 at 21:06

    Any changes for Indigo? The archetype sample app deploys fine to GAE but I’m having trouble getting the dev server to work. The POM has an error: Plugin execution not covered by lifecycle configuration: org.datanucleus:maven-datanucleus-plugin:1.1.4:enhance (execution: default, phase: compile)

    Below is the terminal readout. Thanks for any suggestions you can provide. I’ve been looking for other GAE + Eclipse + Maven archetypes but haven’t found any that get me as far as yours.

    John

    [INFO] Scanning for projects...
    [INFO] ------------------------------------------------------------------------
    [INFO] Building Gae + Eclipse + Maven Example - Guestbook
    [INFO]    task-segment: [gae:run]
    [INFO] ------------------------------------------------------------------------
    [INFO] Preparing gae:run
    [INFO] [resources:resources {execution: default-resources}]
    [INFO] Using 'UTF-8' encoding to copy filtered resources.
    [INFO] Copying 1 resource
    [INFO] [compiler:compile {execution: default-compile}]
    [INFO] Nothing to compile - all classes are up to date
    [INFO] [resources:testResources {execution: default-testResources}]
    [INFO] Using 'UTF-8' encoding to copy filtered resources.
    [INFO] skip non existing resourceDirectory /Users/FR1/Documents/workspace/frTest7/src/test/resources
    [INFO] [compiler:testCompile {execution: default-testCompile}]
    [INFO] No sources to compile
    [INFO] [surefire:test {execution: default-test}]
    [INFO] No tests to run.
    [INFO] [war:war {execution: default-war}]
    [INFO] Packaging webapp
    [INFO] Assembling webapp[frTest7] in [/Users/FR1/Documents/workspace/frTest7/target/frTest7-1]
    [INFO] Dependency[Dependency {groupId=org.datanucleus, artifactId=datanucleus-core, version=1.1.5, type=jar}] has changed (was Dependency {groupId=org.datanucleus, artifactId=datanucleus-core, version=1.1.5, type=jar}).
    [INFO] Dependency[Dependency {groupId=javax.jdo, artifactId=jdo2-api, version=2.3-eb, type=jar}] has changed (was Dependency {groupId=javax.jdo, artifactId=jdo2-api, version=2.3-eb, type=jar}).
    [INFO] Processing war project
    [INFO] Copying webapp resources[/Users/FR1/Documents/workspace/frTest7/src/main/webapp]
    [INFO] Webapp assembled in [99 msecs]
    [INFO] Building war: /Users/FR1/Documents/workspace/frTest7/target/frTest7-1.war
    [INFO] [gae:run {execution: default-cli}]
    2011-10-20 13:39:17.403 java[12111:903] [Java CocoaComponent compatibility mode]: Enabled
    2011-10-20 13:39:17.407 java[12111:903] [Java CocoaComponent compatibility mode]: Setting timeout for SWT to 0.100000
    Oct 20, 2011 5:39:18 PM com.google.apphosting.utils.jetty.JettyLogger info
    INFO: Logging to JettyLogger(null) via com.google.apphosting.utils.jetty.JettyLogger
    Oct 20, 2011 5:39:18 PM com.google.apphosting.utils.config.AppEngineWebXmlReader readAppEngineWebXml
    INFO: Successfully processed /Users/FR1/Documents/workspace/frTest7/target/frTest7-1/WEB-INF/appengine-web.xml
    Oct 20, 2011 5:39:18 PM com.google.apphosting.utils.config.AbstractConfigXmlReader readConfigXml
    INFO: Successfully processed /Users/FR1/Documents/workspace/frTest7/target/frTest7-1/WEB-INF/web.xml
    Oct 20, 2011 1:39:19 PM com.google.appengine.tools.development.DevAppServerImpl start
    INFO: The server is running at http://localhost:8080/
    
    • 9 hleinone January 6, 2012 at 15:36

      Sorry for the late response John, but have you by any chance imported it to Eclipse using m2eclipse? The problem with m2e is that the Maven plugins do not get fired since they’d need respective m2e plugins available.

      For instance check out how Android Development Tools and Maven integrate. Few times I’ve decided to start making such a plugin, but each and every time I’ve given up after being totally lost in OSGi and Eclipse Plugin development.

      Currently I’m working on a new blog post about the matter, since they’ve introduced the Google Cloud SQL which f’s up things again.


  1. 1 HOW-TO: GAE + Eclipse + Maven « Ham and Eggs Trackback on July 25, 2010 at 11:02
  2. 2 Bozho's tech blog » Google App Engine and Maven Trackback on August 31, 2011 at 01:14

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s





Follow

Get every new post delivered to your Inbox.