Bad request when updating Appengine with mvn appengine:update - google-app-engine

i'm getting the following error, when I try to update a appengine-application with the appengine-maven-plugin:
400 Bad Request
Error when loading application configuration:
Unable to assign value '1.8.3' to attribute 'version':
Value '1.8.3' for version does not match expression '^(?:^(?!-)[a-z\d\-]{0,62}[a-z\d]$)$'
This is confusing to my because my appengine-web.xml looks like follows:
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
<application>helloworld</application>
<version>0-0-1</version>
<threadsafe>true</threadsafe>
<precompilation-enabled>false</precompilation-enabled>
<system-properties>
<property name="java.util.logging.config.file" value="WEB-INF/logging.properties"/>
</system-properties>
</appengine-web-app>
I'm wondering why appengine-maven-plugin wants to use 1.8.3 as application-version. 1.8.3 is the version of appengine-sdk i want to use.
In my POM it's configured as follows:
<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-api-1.0-sdk</artifactId>
<version>${appengine.version}</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jstl</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
and later on
<plugin>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-maven-plugin</artifactId>
<version>${appengine.version}</version>
<configuration>
<appVersion>${appengine.app.version}</appVersion>
</configuration>
</plugin>
${appengine.app.version} points to 1.8.3
I'm using Maven in Version 3.1 and Java 1.7.0_25
What do I wrong? Can anyone help my?
Thanks a lot

I had the same issue as you described. When I added the "version" element in the configuration element, with value pointing to the version of the app in my appengine-web.xml file, mvn appengine:update completed successfully. (maven v3.1.0, appengine plugin v1.8.3)
in pom.xml:
....
<plugin>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-maven-plugin</artifactId>
<version>${appengine.version}</version>
<configuration>
<version>MY-VERSION</version>
</configuration>
</plugin>
...
in appengine-web.xml:
...
<version>MY-VERSION</version>
...

If you generated the project with the archetype skeleton, like I did, and you have a block similar to
<properties>
<app.id>MY-GAE-PROJECT-ID</app.id>
<app.version>1</app.version>
<appengine.version>1.9.20</appengine.version>
<gcloud.plugin.version>0.9.58.v20150505</gcloud.plugin.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
in your pom.xml and your appengine-web.xml looked like
<?xml version="1.0" encoding="utf-8"?>
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
<application>${app.id}</application>
<version>1</version>
etc....
when it got made, then, modify appengine-web.xml to be ${app.version} because they so helpfully already added that property with the archetype but never used it anywhere. Then, update your pom.xml's app.version to be your appropriate version (if you don't use "1"). Then, scroll down in the pom.xml to where you see
<groupId>com.google.appengine</groupId>
<artifactId>appengine-maven-plugin</artifactId>
<version>${appengine.version}</version>
<configuration>
<enableJarClasses>false</enableJarClasses>
and inside the configuration block there add
<version>${app.version}</version>

Try to change appengine-web.xml entry from <version>0-0-1</version> to <version>1</version>. Regards, Adam.

In changed only the pom.xml file by adding the plugin>configuration>version tag (per below)...
<plugin>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-maven-plugin</artifactId>
<version>${project.appengine.version}</version>
<configuration>
<port>8888</port>
*<version>${app.version}</version>*
</configuration>
</plugin>

The way I solved this issue was trivial in my console I executed mvn clean install and then the appcfg.cmd -A [your app] update target\appengine-try-java-1.0 command.

Related

GWT 2.7 + GAE app looks for codeserver when deployed

Why does appengine try to use Super Dev Mode?
Every time I deploy my GWT app to appengine and try to access it I get the white loading screen, then after about 20-30 seconds I get this message:
I use maven with the gwt-maven-plugin and appengine-maven-plugin. Deploying using the maven-gae-plugin gives the same results.
If I switch back to using 2.6.1 versions of gwt and the gwt-maven-plugin it deploys ok, so it would seem it's something to do with the automatic dev mode launcher.
Some of my pom.xml
<build>
<outputDirectory>${webappDirectory}/WEB-INF/classes</outputDirectory>
<resources>
<resource>
<directory>src/main/resources</directory>
</resource>
<resource>
<directory>src/main/super</directory>
</resource>
<resource>
<directory>${project.build.directory}/generated-sources/apt</directory>
</resource>
<resource>
<directory>${project.build.directory}/generated-sources/gwt</directory>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<source>${target.jdk}</source>
<target>${target.jdk}</target>
<encoding>${project.build.sourceEncoding}</encoding>
<proc>none</proc>
</configuration>
</plugin>
<!-- JUnit Testing - skip *.GwtTest cases -->
<!-- 'mvn test' - runs the Jukito tests -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
<configuration>
<includes>
<include>**/*Test.java</include>
</includes>
<excludes>
<exclude>**/*GwtTest.java</exclude>
<exclude>**/*JUnitTest.java</exclude>
</excludes>
</configuration>
</plugin>
<!-- GWT -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>${gwt-maven-plugin.version}</version>
<configuration>
<strict>true</strict>
<testTimeOut>180</testTimeOut>
<!-- With multiple tests use GwtTestSuite.java for speed -->
<includes>**/*GwtTest.java</includes>
<mode>htmlunit</mode>
<extraJvmArgs>-Xss1024k -Xmx2048M -XX:MaxPermSize=512M</extraJvmArgs>
<logLevel>INFO</logLevel>
<style>PRETTY</style>
<copyWebapp>true</copyWebapp>
<hostedWebapp>${webappDirectory}</hostedWebapp>
<server>com.google.appengine.tools.development.gwt.AppEngineLauncher</server>
<appEngineVersion>${gae.version}</appEngineVersion>
<appEngineHome>${gae.home}</appEngineHome>
<extraJvmArgs>-Dappengine.sdk.root=${gae.home}</extraJvmArgs>
<extraJvmArgs>-Ddatastore.default_high_rep_job_policy_unapplied_job_pct=20</extraJvmArgs>
<port>8888</port>
<runTarget>Project.html</runTarget>
<modules>
<module>com.utilitiessavings.usavappv7.Project</module>
</modules>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>test</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- Google App Engine Deployment -->
<plugin>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-maven-plugin</artifactId>
<version>${gae.version}</version>
<configuration>
<enableJarSplitting>true</enableJarSplitting>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<!-- Google Web Toolkit dependencies -->
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>${gwt.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
<version>${gwt.version}</version>
<scope>runtime</scope>
</dependency>
<!-- Google App Engine dependencies -->
<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-api-1.0-sdk</artifactId>
<version>${gae.version}</version>
</dependency>
<!-- Testing -->
<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-api-labs</artifactId>
<version>${gae.version}</version>
</dependency>
<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-api-stubs</artifactId>
<version>${gae.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-testing</artifactId>
<version>${gae.version}</version>
<scope>test</scope>
</dependency>
<!-- Persistence dependencies -->
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>persistence-api</artifactId>
<version>${persistence-api.version}</version>
</dependency>
<dependency>
<groupId>com.googlecode.objectify</groupId>
<artifactId>objectify</artifactId>
<version>${objectify.version}</version>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>${javax.validation.version}</version>
</dependency>
<!-- Other dependencies -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>${servlet-api.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>jstl</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
</dependencies>
In my Project.gwt.xml
<add-linker name="xsiframe" />
(Tried removing this line but still got the same result)
Environment
Eclipse Luna (4.4.1)
Maven 3.2.3 (3.2.1 Embedded)
m2eclipse 1.5.0
gwt:compile tries to work "incrementally" by comparing the timestamp of the nocache.js file with the ones of the source files, and skipping GWT compilation if it thinks the output is up-to-date. This is brittle though. gwt:run (without <superDevMode>false</superDevMode>; and gwt:run-codeserver with launcherDir) will overwrite the nocache.js with a SuperDevMode-specific version, and this is likely to lead to gwt:compile skipping the compilation.
The takeaway is: when deploying or "releasing", make sure you first run mvn clean or force gwt:compile to run by passing -Dgwt.compiler.force to Maven.
Just for information, I had the same problem, caused by the usage of a non-standard project structure.
Maven was copying the .nocache files in a directory different than /target/which prevented the clean plugin from cleaning the generated files.
Adding a new with the directory where the files are copied solves the problem.

camel cxf glassfish BusException: No DestinationFactory was found for the namespace http://cxf.apache.org/transports/http

I have a camel route fronted with a CXF Web Service consumer (from). I'm deploying in Glassfish 4.0 and this works fine when using the servlet spec 2.4. I now need to enhance the route by adding some persistence along the way which is being done with JPA. Doing this requires an upgrade to servlet spec 2.5+ (I've gone to 3.0)
When the servlet spec is changed to 2.5+ the following error occurs on deployment: java.lang.IllegalStateException: The lifecycle method [finalizeConfig] must not throw a checked exception. Most solutions to this say to remove cxf-rt-transports-http-jetty-2.7.11.jar.
When the jetty jar is removed, the deployment error becomes: java.io.IOException: Could not find destination factory for transport http://schemas.xmlsoap.org/soap/http
Solutions to this, such as CXF BusException No DestinationFactory for namespace http://cxf.apache.org/transports/http OR org.apache.cxf.BusException: No DestinationFactory was found for the namespace http://schemas.xmlsoap.org/soap/http/ say to import the cxf-servlet.xml file which then requires the inclusion of the jar cxf-rt-transports-http-2.7.11.jar (I removed this when I removed the jetty jar). Including these files then gives the following deployment error: java.io.IOException: Cannot find any registered HttpDestinationFactory from the Bus.
The solutions for this error all say to include the jar cxf-rt-transports-http-jetty-2.7.11.jar. This puts me back where I started having to remove it due to the servlet spec upgrade.
I've been able to create a small project to demonstrate this and have included the contents below. I've also tried deploying on Glassfish 4.1 and various combinations of different jar versions (CXF 3.0 excluding the 2.7 jars from camel etc) but I'm still unable to deploy the app in Glassfish.
I'm able to run this with the maven camel plugin 'mvm camel:run' (this requires de-scoping the cxf-rt-transports-http*.jar files from test. Of course this works because I'm outside the glassfish container.
Any help would be greatly appreciated.
pom.xml:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>camel-cxf-gf</artifactId>
<packaging>war</packaging>
<version>0.1</version>
<name>Camel with CXF in GF</name>
<properties>
<camel-version>2.13.1</camel-version>
<cxf-version>2.7.11</cxf-version>
<buildNumber>0.1</buildNumber>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>4.0.6.RELEASE</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core</artifactId>
<version>${camel-version}</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-cxf</artifactId>
<version>${camel-version}</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<!-- cxf using slf4j -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.5</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.5</version>
</dependency>
<!-- using Jetty with CXF -->
<!-- "The Google" says to exclude this when deploying to Glassfish (test scope only) -->
<!-- To run with mvn camel:run, comment out the test scope on BOTH cxf-rt dependencies -->
<!-- However, if present for GF deploy, you get the error: The lifecycle method [finalizeConfig] must not throw a checked exception -->
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http-jetty</artifactId>
<version>${cxf-version}</version>
<scope>test</scope>
</dependency>
<!-- "The Google" says to exclude this (test scope only) -->
<!-- To run with mvn camel:run, comment out the test scope on BOTH cxf-rt dependencies -->
<!-- If present for GF deploy, you get the error: java.io.IOException: Cannot find any registered HttpDestinationFactory from the Bus -->
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
<version>${cxf-version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<!-- allows the route to be executed via 'mvn camel:run', NOTE: must comment out the test scope on the cxf-rt-transports dependencies above.... -->
<plugin>
<groupId>org.apache.camel</groupId>
<artifactId>camel-maven-plugin</artifactId>
<version>${camel-version}</version>
<configuration>
<fileApplicationContextUri>
classpath:META-INF/applicationContext.xml
</fileApplicationContextUri>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<configuration>
<webXml>web/WEB-INF/web.xml</webXml>
<failOnMissingWebXml>true</failOnMissingWebXml>
<archive>
<manifestEntries>
<Build-Version>${project.version}</Build-Version>
<Build-Revision>${buildNumber}</Build-Revision>
<Build-Date>${maven.build.timestamp}</Build-Date>
</manifestEntries>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>
web.xml:
<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0">
<display-name>Camel CXF, JMS Web Application</display-name>
<!-- location of spring xml files -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:META-INF/applicationContext.xml</param-value>
</context-param>
<!-- the listener that kick-starts Spring -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
</web-app>
The CXF Service:
package com.example;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;
#WebService(serviceName = "HelloMessage", targetNamespace = "http://example.com/")
public interface HelloMessageEndpoint {
#WebMethod(operationName = "sayHello")
#WebResult(name = "messageAnswer", targetNamespace = "http://example.com/", partName = "messageAnswer")
public String sayHello(#WebParam(name = "name") String name);
}
My applicationContext.xml which contains the Spring DSL camel route (under resources/META-INF):
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:cxf="http://camel.apache.org/schema/cxf"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd
http://camel.apache.org/schema/cxf
http://camel.apache.org/schema/cxf/camel-cxf.xsd
">
<import resource="classpath:META-INF/cxf/cxf.xml"/>
<!-- This doesn't seem to make a difference -->
<!--<import resource="classpath:META-INF/cxf/cxf-extension-camel.xml"/>-->
<!-- When cxf-rt-transports-http is removed (test scope) cxf-servlet.xml is no longer available -->
<!--<import resource="classpath:META-INF/cxf/cxf-servlet.xml"/>-->
<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml"/>
<cxf:cxfEndpoint id="helloMessageEndpoint"
address="http://0.0.0.0:9000/HelloWS/"
serviceClass="com.example.HelloMessageEndpoint"
endpointName="HelloMessageEndpoint"
serviceName="HelloMessage"
loggingFeatureEnabled="false"/>
<camelContext id="messageContext" streamCache="true" xmlns="http://camel.apache.org/schema/spring">
<route>
<from uri="cxf:bean:helloMessageEndpoint"/>
<log loggingLevel="INFO" message="====> CXF Message Body: ${body}"/>
</route>
</camelContext>
</beans>
As you are using address="http://0.0.0.0:9000/HelloWS/", not the relative path, cxf-rt-transports-http-jetty-2.7.11.jar is need. If you want to use the servlet transport you need to deploy the CXFServlet in you web.xml first, and setup the address of to be relative path, then you should be able to access the CXF endpoint there.

Maven default compile not picking up custom plugin goal

I have written a custom plugin, then I installed it. Then I modified the pom.xml of the project from which I want to use the custom plugin. When I invoke my plugin goal directly the plugin goal is executed successfully, but when I try to mvn compile my custom plugin goal is not executed. What might be the reason?
My plugin's pom.xml:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.xxx.plugins.maven</groupId>
<artifactId>datanucleus-enhance-maven-plugin</artifactId>
<packaging>maven-plugin</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>Datanucleus-enhance Maven Plugin</name>
<dependencies>
<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-annotations</artifactId>
<version>3.2</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<version>2.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
My project using custom plugin I added following:
<!-- enhance JDO classes -->
<plugin>
<groupId>com.sukantu.plugins.maven</groupId>
<artifactId>datanucleus-enhance-maven-plugin</artifactId>
<version>0.0.1-SNAPSHOT</version>
<configuration>
<jdoClassDirList>
<param>target/${project.artifactId}-${project.version}/WEB-INF/classes/</param>
</jdoClassDirList>
</configuration>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>enhance</goal>
</goals>
</execution>
</executions>
</plugin>
I followed section Attaching the Mojo to the Build Lifecycle from maven guide site: https://maven.apache.org/guides/plugin/guide-java-plugin-development.html
The following command successfully calls my plugin goal:
mvn com.xxx.plugins.maven:datanucleus-enhance-maven-plugin:enhance
The following command does NOT successfully call my plugin goal:
mvn compile
Thanks for any inputs!
I came across this link:
How do I link a plugin execution to a phase in maven without forcing me to specify plugin on command line
So I removed <pluginManagement> tags so <plugins> appear directly under '<build>'. Then I tried 'mvn compile' from command line and it successfully called my custom plugin goal!
But when I checked pom.xml in Eclipse I saw another error referenced here How to solve “Plugin execution not covered by lifecycle configuration” .
Since the command line is working correctly, I think this is m2e Eclipse plugin error and so I have disabled the marked by going to 'Eclipse' -> 'Window' -> 'Show View' -> 'Markers' -> right click that marker -> 'Delete'. Now Eclipse is not showing any error and command line is also working as expected. Hope this helps someone else.

GWT + Appengine + JPA + Eclipse + Maven: How to get them to work together

I have a project where I want to use the eclipse GWT tools (dev mode and debugger) to interact with the GWT/Appengine/Maven application I am writing. I have things in a somewhat working order but there are still a few things around the edges I don't have right. I will post the POM file if anyone could help me with these few issues.
When I do a Maven->Update Project, I loose the appengine nature in the eclipse project properties and have to go to Properties, Google, AppEngine and recheck Use Google App Engine. Is there something I can do in the POM where I don't loose the appengine nature? I'm using the Google appengine-maven-plugin plugin. That seems to be the official one to use.
After a maven build, I have to do a project clean to get the jpa classes enhanced before I can run them with the Run As - Web Application launcher. The maven build has test cases for the domain objects that work within the build - and I see the classes being enhance with this goal in the build 'maven-datanucleus-plugin:3.1.3:enhance (default)'. But running as a Web Application it throws out errors telling me the classes are not enhanced unless I do a project clean which cause eclipse to do it's enhance. Is there a way to avoid this extra step?
I can not run the JUnit View test runner or use a launcher that uses that view. The JUnit View complains that: "Caused by: org.datanucleus.exceptions.NucleusException: Plugin (Bundle) "org.datanucleus" is already registered. Ensure you dont have multiple JAR versions of the same plugin in the classpath. The URL "file:/C:/Users/bondsd/.m2/repository/org/datanucleus/datanucleus-core/3.1.3/datanucleus-core-3.1.3.jar" is already registered, and you are trying to register an identical plugin located at URL "file:/C:/Program%20Files/eclipse/plugins/com.google.appengine.eclipse.sdkbundle_1.7.5/appengine-java-sdk-1.7.5/lib/opt/user/datanucleus/v2/datanucleus-core-3.1.3.jar."". I have tried various things, such as removing the datanucleus plugin and/or dependencies, various configuration options, and unchecking the 'Use Datnucleus JDO/JPA to access the datastore' in the app engine properties panel. Is there a way to get this to work?
Below is the POM I used with the company and project name x'ed out. If you need the launchers I will be glad to post them too. Thanks in advance for any advice or help on this. I have searched the internet and haven't found the right solution yet.
<modelVersion>4.0.0</modelVersion>
<groupId>com.xxx.xxxx</groupId>
<artifactId>shell</artifactId>
<packaging>war</packaging>
<version>0.1.0-proto</version>
<name>XXXXXX</name>
<description>A XXXXXXXX</description>
<properties>
<webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- GWT version -->
<gwt.version>2.5.1</gwt.version>
<gwt.style>PRETTY</gwt.style>
<!-- GAE version -->
<appengine.version>1.7.6</appengine.version>
<appengine.sdk.version>1.7.6</appengine.sdk.version>
<appengine.orm.version>2.1.2</appengine.orm.version>
<appengine.port>8888</appengine.port>
<datanucleus.core.version>3.1.3</datanucleus.core.version>
<datanucleus.api.version>3.1.3</datanucleus.api.version>
<datanucleus.enhancer.version>3.1.1</datanucleus.enhancer.version>
<datanucleus.plugin.version>3.1.3</datanucleus.plugin.version>
<slf4jVersion>1.6.6</slf4jVersion>
<log4j.version>1.3</log4j.version>
<junit.version>4.11</junit.version>
</properties>
<dependencies>
<dependency>
<groupId>com.google.gwt.inject</groupId>
<artifactId>gin</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>com.google.inject.extensions</groupId>
<artifactId>guice-servlet</artifactId>
<version>3.0</version>
</dependency>
<!-- GWT dependencies -->
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
<version>${gwt.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>${gwt.version}</version>
<scope>provided</scope>
</dependency>
<!-- GAE SDK -->
<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-api-1.0-sdk</artifactId>
<version>${appengine.version}</version>
</dependency>
<!-- For the servlet filter -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<!-- <dependency> <groupId>jstl</groupId> <artifactId>jstl</artifactId>
<version>1.2</version> </dependency> -->
<!-- RequestFactory server -->
<dependency>
<groupId>com.trycatchsoft.gwt.requestfactory</groupId>
<artifactId>injected-requestfactory</artifactId>
<version>1.2.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.google.web.bindery</groupId>
<artifactId>requestfactory-server</artifactId>
<version>${gwt.version}</version>
</dependency>
<dependency>
<groupId>com.google.web.bindery</groupId>
<artifactId>requestfactory-apt</artifactId>
<version>${gwt.version}</version>
</dependency>
<!-- RequestFactory will use JSR 303 javax.validation -->
<!-- Validation API -->
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.0.0.GA</version>
</dependency>
<!-- Validation Implementation -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>4.3.0.Final</version>
</dependency>
<!--Test Dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.9.0</version>
<scope>test</scope>
</dependency>
<!-- GAE libraries for local testing as described here: http://code.google.com/appengine/docs/java/howto/unittesting.html -->
<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-api-labs</artifactId>
<version>${appengine.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-api-stubs</artifactId>
<version>${appengine.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-testing</artifactId>
<version>${appengine.version}</version>
<scope>test</scope>
</dependency>
<!-- End of Test Dependencies -->
<!-- JPA 2.0 for GAE -->
<dependency>
<groupId>com.google.appengine.orm</groupId>
<artifactId>datanucleus-appengine</artifactId>
<version>${appengine.orm.version}</version>
</dependency>
<!-- Datanucleus -->
<!-- datanucleus-core is not needed for compilation. in fact, it cannot
have compile scope because the datanucleus plugin automatically adds it during
enhancement and complains if there are two copies. app should not depend
on any classes in this lib anyways. -->
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-core</artifactId>
<version>${datanucleus.core.version}</version>
<scope>runtime</scope>
<exclusions>
<exclusion>
<groupId>javax.transaction</groupId>
<artifactId>transaction-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- datanucleus-jpa is needed during compilation for its #Extension annotation
which is used throughout entity classes -->
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-api-jpa</artifactId>
<version>${datanucleus.api.version}</version>
</dependency>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-jpa_2.0_spec</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>javax.persistence</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-jdk14</artifactId>
<version>1.7.2</version>
</dependency>
<!-- SLF4J logging libraries -->
<!-- <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId>
<version>${slf4jVersion}</version> </dependency> <dependency> <groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId> <version>1.7.2</version> </dependency>
<dependency> <groupId>log4j</groupId> <artifactId>log4j</artifactId> <version>1.2.16</version>
</dependency> -->
<!-- End SLF4J logging libraries -->
</dependencies>
<build>
<!-- Generate compiled stuff in the folder used for developing mode -->
<outputDirectory>${webappDirectory}/WEB-INF/classes</outputDirectory>
<resources>
<resource>
<directory>src/main/resources</directory>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
<dependencies>
<!-- Need to run the RF Validation tool. This works on both the command-line
and in Eclipse, provided that m2e-apt is installed. -->
<dependency>
<groupId>com.google.web.bindery</groupId>
<artifactId>requestfactory-apt</artifactId>
<version>${gwt.version}</version>
</dependency>
</dependencies>
</plugin>
<!-- GWT Maven Plugin -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>2.5.1-rc1</version>
<dependencies>
<!-- Force plugin to use same gwt version -->
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>${gwt.version}</version>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-dev</artifactId>
<version>${gwt.version}</version>
</dependency>
</dependencies>
<configuration>
<strict>true</strict>
<extraJvmArgs>-Xss1024K -Xmx1024M -XX:MaxPermSize=256M</extraJvmArgs>
<logLevel>INFO</logLevel>
<style>${gwt.style}</style>
<copyWebapp>true</copyWebapp>
<hostedWebapp>${webappDirectory}</hostedWebapp>
<runTarget>Shell.html</runTarget>
<webappDirectory>${webappDirectory}</webappDirectory>
<module>com.ihg.dashboard.Shell</module>
<server>com.google.appengine.tools.development.gwt.AppEngineLauncher</server>
<i18nMessagesBundle>com.ihg.dashboard.client.Messages</i18nMessagesBundle>
<appEngineVersion>${appengine.version}</appEngineVersion>
<!-- Should GWT create the Story of Your Compile Report -->
<compileReport>false</compileReport>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>test</goal>
<goal>i18n</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-maven-plugin</artifactId>
<version>${appengine.version}</version>
<configuration>
<jvmFlags>
<jvmFlag>-Ddatastore.backing_store=${project.basedir}\local_db.bin</jvmFlag>
</jvmFlags>
<enhancerApi>JPA</enhancerApi>
</configuration>
</plugin>
<!-- This plug-in "enhances" your domain model objects (i.e. makes them
persistent for datanucleus) -->
<!-- Might not need this, appengine is supposed to do this appengine:enhance -->
<plugin>
<groupId>org.datanucleus</groupId>
<artifactId>maven-datanucleus-plugin</artifactId>
<version>${datanucleus.plugin.version}</version>
<configuration>
<mappingIncludes>**/domain/*.class</mappingIncludes>
<metadataIncludes>**/domain/*.class</metadataIncludes>
<verbose>false</verbose>
<enhancerName>ASM</enhancerName>
<api>JPA</api>
</configuration>
<executions>
<execution>
<phase>process-classes</phase>
<goals>
<goal>enhance</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<!-- enhancement requires the gwt-user jar because many of the entity
classes implement IsSerializable and the enhancer needs it on the classpath
to function. because the gwt-user library has a scope of provided, it is
only available on the compilation and test classpath, and is not transitive
to the enhancement classpath. -->
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>${gwt.version}</version>
</dependency>
<dependency>
<!-- force maven-datanucleus-plugin to use the same version of datanucleus-core -->
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-core</artifactId>
<version>${datanucleus.core.version}</version>
</dependency>
</dependencies>
</plugin>
<!-- Copy static web files before executing gwt:run -->
<!-- May not need this now -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>exploded</goal>
</goals>
</execution>
</executions>
<configuration>
<webXml>${webappDirectory}/WEB-INF/web.xml</webXml>
<webappDirectory>${webappDirectory}</webappDirectory>
</configuration>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<!--This plugin's configuration is used to store Eclipse m2e settings
only. It has no influence on the Maven build itself. -->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.codehaus.mojo</groupId>
<artifactId>
gwt-maven-plugin
</artifactId>
<versionRange>
[2.5.1-rc1,)
</versionRange>
<goals>
<goal>i18n</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
<pluginExecution>
<pluginExecutionFilter>
<groupId>
org.datanucleus
</groupId>
<artifactId>
maven-datanucleus-plugin
</artifactId>
<versionRange>
${datanucleusVersion}
</versionRange>
<goals>
<goal>enhance</goal>
</goals>
</pluginExecutionFilter>
<action>
<execute />
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
=======================================
On Edit: Here is a solution to bullet point 3. Disable the JPA/JDO in the Project Properties - Google - App Engine page. Go to the build path and remove all the datanucleus libraries that are listed as top level libraries (these are put there by enabled the appengine in the project properties). Make sure the Maven dependencies are at the bottom of the list on the Order Tab.
On Edit 2: I found a way to keep the GAE project nature when I do a Maven->Update Project. I added this to the POM (even though I am using an eclipse build with m2e installed)
<plugin>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.7</version>
<configuration>
<downloadSources>true</downloadSources>
<downloadJavadocs>false</downloadJavadocs>
<wtpversion>2.0</wtpversion>
<additionalBuildcommands>
<buildCommand>
<name>com.google.gwt.eclipse.core.gwtProjectValidator</name>
</buildCommand>
</additionalBuildcommands>
<additionalProjectnatures>
<projectnature>com.google.gwt.eclipse.core.gwtNature</projectnature>
<projectnature>com.google.appengine.eclipse.core.gaeNature</projectnature>
</additionalProjectnatures>
</configuration>
</plugin>
This addresses Bullet point 1. So now I have points 1 and 3 solved (kind of). I still need a way to address bullet point 2, although the work around is easy if I remember to do it. I am more worried about the people who get the code after me remembering to do it.
I am also looking for a way to not use the eclipse launcher at all. I know it can be done with adding various profiles and configs. I just need to find the right configs to do that. By this, I mean a profile that will run the gwt code in dev mode (or super-dev mode) and also a profile that will run the debugger with the gwt code in dev mode.
On Edit 3: I solved bullet point 2. It was as simple as turning off Project->Build Automatically. I'm not sure what that was on in the first place.
That is all 3 bullet points solved. At this point I probably should create an answer for the question and mark it solved for those that are interested in this and didn't read down this far. I will do that in a day or two (when I have the time to compose a nice answer).
It looks like your maven setup is good, but let me make some observations that may help.
1) I would remove the enhancerApi from the appengine-maven-plugin as we're just executing the same thing as the maven-datanucleus-plugin. As a result, don't run the appengine:enhance goal along with the datanucleus plugin's goals.
2) The datanucleus plugin is setup only to enhance domain classes, which sounds right to me, but just verify this I guess.
3) I'm not the best with eclipse anymore, but I'm curious which maven plugin you are using, the m2eclipse plugin is developed by sonatype and the most accurate one in my opinion.
4) The execution of the war plugin on compile seems wrong to me, as this should default to the package phase anyway, which ensures other phases have properly executed beforehand.
5) You may need to get set up a few more execute directives for the plugins, or rely on defaults if they exist. The maven lifecycle can be a bit tricky, and I would recommend reading up on http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html and making sure eclipse is running the correct phases before launching your application.

mvn-gae-plugin suddenly broken

I'm not sure what happened but I've made not changes to my pom and have only done a clean install but now running my app with mvn gae:run gives me the following error:
[ERROR] Failed to execute goal net.kindleit:maven-gae-plugin:0.9.4:run (default-cli) on project geoip-service: Execution default-cli of goal net.kindleit:maven-gae-plugin:0.9.4:run failed: Plugin net.kindleit:maven-gae-plugin:0.9.4 or one of its dependencies could not be resolved: Failed to collect dependencies for net.kindleit:maven-gae-plugin:jar:0.9.4 (): Failed to read artifact descriptor for net.kindleit:gae-runtime:pom:1.7.5: Could not find artifact net.kindleit:maven-gae-parent:pom:0.9.6-SNAPSHOT in genius (our_own_repo_here)
I'm using the 1.7.2 version of the sdk so I'm not sure where the 1.7.5 could be coming from.
For the time being, you can use this ugly hack
<properties>
<gae.version>1.7.5</gae.version>
<gae-runtime.version>1.7.5.1</gae-runtime.version>
</properties>
<plugin>
<groupId>net.kindleit</groupId>
<artifactId>maven-gae-plugin</artifactId>
<version>${maven.gae.plugin.version}</version>
<configuration>
<unpackVersion>${gae.version}</unpackVersion>
<serverId>appengine.google.com</serverId>
<appDir>${webappDirectory}</appDir>
</configuration>
<dependencies>
<dependency>
<groupId>net.kindleit</groupId>
<artifactId>gae-runtime</artifactId>
<version>${gae-runtime.version}</version>
<type>pom</type>
</dependency>
</dependencies>
</plugin>
I still don't know what the issue was, I.e. who was pulling in gae-runtime of version 1.7.5 but this is the work around that worked for me. Add the following under your maven-gae-plugin in profile/build/plugins/plugin etc.
<dependencies>
<dependency>
<groupId>net.kindleit</groupId>
<artifactId>gae-runtime</artifactId>
<version>1.7.2</version>
<type>pom</type>
</dependency>
</dependencies>

Resources