I have a Google App Engine project that needs to be build using java 1.8. When the build is complete I need to run the web application but using Java 1.7.
This works fine from eclipse where I am currently building using java 1.8 and then I can configure the run configuration to use JRE 1.7 when running:
But how do I do the same from command line? At the moment I do (from command line):
mvn clean install
mvn appengine:devserver_start
When running the last command, starting the app, I get the error:
Error creating bean with name 'beanNameHandlerMapping' defined in org.springframework.web.servlet.config.annotation.DelegatingWebMvcConfiguration: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping]: Factory method 'beanNameHandlerMapping' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mvcConversionService' defined in org.springframework.web.servlet.config.annotation.DelegatingWebMvcConfiguration: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.format.support.FormattingConversionService]: Factory method 'mvcConversionService' threw exception; nested exception is java.lang.NoClassDefFoundError: java.time.format.FormatStyle is a restricted class. Please see the Google App Engine developer's guide for more details.
which appears to be related to the fact that I am running with java 1.8: How to deal with App Engine Devserver exception due to FormatStyle restricted class?
I guess I could write a script that does something like:
- Run mvn clean install
- Set JDK to 1.7 for current session
- Runs the web app (now under java 1.7)
But is there a maven way to do this in the pom.xml?