GWT 2.8 with App Engine on Java 7

541 views
Skip to first unread message

Paul Mazzuca

unread,
Mar 9, 2016, 2:57:13 PM3/9/16
to GWT Users
Using the maven gwt and appengine plugins, is it possible to compile GWT 2.8 in Java 8, and then app engine related files using Java 7?  I realize the managed VMs support Java 8, but it would be nice to stick with the app engine environment which currently only support Java 7?  

I am wondering if there exists some maven configuration that would first compile all the GWT files in Java 8, thereby converting them to javascript, and then use java 7 for all the server files.

Michael Joyner

unread,
Mar 9, 2016, 2:59:53 PM3/9/16
to google-we...@googlegroups.com
Is there any reason you can't split the project up into two projects? A java8 => js frontend, and the java7 backend?


On 03/09/2016 02:57 PM, Paul Mazzuca wrote:
Using the maven gwt and appengine plugins, is it possible to compile GWT 2.8 in Java 8, and then app engine related files using Java 7?  I realize the managed VMs support Java 8, but it would be nice to stick with the app engine environment which currently only support Java 7?  

I am wondering if there exists some maven configuration that would first compile all the GWT files in Java 8, thereby converting them to javascript, and then use java 7 for all the server files.
--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-tool...@googlegroups.com.
To post to this group, send email to google-we...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

Paul Mazzuca

unread,
Mar 9, 2016, 3:09:44 PM3/9/16
to google-we...@googlegroups.com
"mvn appengine:update" abstracts most of the packaging and compiling, so I am unsure where that separation would need to be implemented.  I will check it out though. Thanks.

--
You received this message because you are subscribed to a topic in the Google Groups "GWT Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-web-toolkit/cK12H59iY0Y/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-web-tool...@googlegroups.com.

Thomas Broyer

unread,
Mar 10, 2016, 3:41:23 AM3/10/16
to GWT Users
GWT 2.8 should support JDK 7, but if you want to use Java 8 features then indeed you need to use a JDK 8 to JavaC your classes.

You could possibly exclude your client code from being compiled with JavaC, and only processed by GWT.

Alternatives I can think of are:
- use Maven Toolchains to use JDK 7 and JDK 8 in the same build;
- use JDK 8 and retrolambda: https://github.com/orfjackal/retrolambda
- split your code into 2 projects/modules, compiled in 2 phases: mvn install the client code with JDK8, then mvn appengine:update the server code with JDK7, which has a dependency in the client code (resolved from local Maven repo).

The cleaner solution IMO is to use separate JDKs (or proper cross-compilation, with bootclasspath et al); either with toolchains or separate build phases. Retrolambda would need some testing in a Java 7 environment to confirm the transformation went well.

Also, Animal Sniffer on your server code would help, in case you don't compile it with a JDK7.

Paul Mazzuca

unread,
Mar 10, 2016, 11:06:47 AM3/10/16
to google-we...@googlegroups.com
Thanks as alway for the prompt response.  I went ahead and reverted to Java 7  (while still using GWT 2.8) as the quick solution, with Google Guava for some more advanced Java 8 like APIs.  After some cursory research, I believe the GAE sandbox will be supporting Java 8 at some point this year, so hopefully the wait won't be too long, at which point I will use Java 8 across the board. 

I am still going to explore the Toolchains option though.  Having more of a clear separation between the client and server may make things easier, at least in my case.  If I get it working, I will share the pom.   Thanks again for all the GWT support.

Drew Spencer

unread,
Mar 15, 2016, 10:17:35 AM3/15/16
to GWT Users
I've had the same problem - was using GWT 2.8 and playing with a few lambdas and such in my GWT code, and even though there was no Java 8 code in my /server package, something (probably the target version in the pom.xml) stopped the maven plugin from deploying, so I had to revert.

Fingers crossed they get round to Java 8 sooner rather than later!


On Thursday, 10 March 2016 16:06:47 UTC, Paul Mazzuca wrote:
Thanks as alway for the prompt response.  I went ahead and reverted to Java 7  (while still using GWT 2.8) as the quick solution, with Google Guava for some more advanced Java 8 like APIs.  After some cursory research, I believe the GAE sandbox will be supporting Java 8 at some point this year, so hopefully the wait won't be too long, at which point I will use Java 8 across the board. 

I am still going to explore the Toolchains option though.  Having more of a clear separation between the client and server may make things easier, at least in my case.  If I get it working, I will share the pom.   Thanks again for all the GWT support.
On Thu, Mar 10, 2016 at 12:41 AM, Thomas Broyer <t.br...@gmail.com> wrote:
GWT 2.8 should support JDK 7, but if you want to use Java 8 features then indeed you need to use a JDK 8 to JavaC your classes.

You could possibly exclude your client code from being compiled with JavaC, and only processed by GWT.

Alternatives I can think of are:
 - use Maven Toolchains to use JDK 7 and JDK 8 in the same build;
 - use JDK 8 and retrolambda: https://github.com/orfjackal/retrolambda
 - split your code into 2 projects/modules, compiled in 2 phases: mvn install the client code with JDK8, then mvn appengine:update the server code with JDK7, which has a dependency in the client code (resolved from local Maven repo).

The cleaner solution IMO is to use separate JDKs (or proper cross-compilation, with bootclasspath et al); either with toolchains or separate build phases. Retrolambda would need some testing in a Java 7 environment to confirm the transformation went well.

Also, Animal Sniffer on your server code would help, in case you don't compile it with a JDK7.

--
You received this message because you are subscribed to a topic in the Google Groups "GWT Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-web-toolkit/cK12H59iY0Y/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-web-toolkit+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages