Openshift Maven project fails to find java 8 compiler
Does anyone know what is needed to force a Maven openshift (jbossews) project to build with a java 8 compiler instead of the java 7 one?
I want to upgrade my project from java 7, so I changed my POM to specify source/target 1.8 in the compiler plugin, 1.8.0 in the enforcer plugin and added a java8 .openshift/marker file to my project. But I see when the maven build starts up it still says
Java version: 1.7.0_85, vendor: Oracle Corporation Java home: /usr/lib/jvm/java-1.7.0-openjdk-126.96.36.199/jre
..and the build fails with remote: Detected JDK Version: 1.7.0-85 is not in the allowed range 1.8.0.
I Had a very similar problem, and had to report an issue which had been fixed for a Wildfly 8 openshift cartridge, titled: "Way to override JAVA_HOME hardcoded in /usr/bin/mvn script"
You should probably also report an issue for your cartridge.
You need to point your environment variable JAVA_HOME to a JDK8 installation.
I just switched my application from java7 to java8 successful. I am running a diy cartridge with spring boot but i faced the same problem you described.
My solution was described in that tutorial very well: http://fabiomaffioletti.me/blog/2015/12/09/openshift-diy-java-8-spring-boot/
He described that he downloaded his own maven and java8. But since java8 is already available under /etc/alternatives/java_sdk_1.8.0 I took this one and only downloaded my own maven und used that one.
The problem with the preinstalled maven is that under /usr/bin/mvn the java7 is hard wired. So it is not enough to just set $JAVA_HOME to java8.