-
1. Re: Openshift Wildfly 8.1 cartridge - JDK8 and maven build
ctomc Jun 12, 2014 5:39 AM (in response to remi.bantos)1 of 1 people found this helpfulYou actually have two interesting problems right here...
Build is not using JDK8 but 7 which should be fixed.
Also you have another problem in your code, if build would be using JDK8 it would fail anyway as you are using apt-maven-plugin which uses APT tool from JDK, which was removed in JDK8.
So in short, your code cannot build properly on JDK8, even when OS cartridge is fixed.
-
2. Re: Openshift Wildfly 8.1 cartridge - JDK8 and maven build
remi.bantos Jun 12, 2014 7:51 AM (in response to ctomc)Thanks a lot for this information.
However, when I export JAVA_HOME to oracle JDK 8 in my DEV environment, this QueryDSL plugin works properly, and maven build performs successfully
(I have also tested it successfully on TRAVIS CI with java 8 level)
For your information, here is the source code of this plugin: querydsl/apt-maven-plugin · GitHub
So I'll be waiting for a fix on Wildfly 8.1 cartridge. Do you have any idea when it will be fixed?
Thanks
-
3. Re: Re: Openshift Wildfly 8.1 cartridge - JDK8 and maven build
fjuma Jun 12, 2014 10:54 AM (in response to remi.bantos)This doesn't seem like a cartridge bug, the build correctly uses JDK 8 when the default maven-war-plugin is used (note that even though JAVA_HOME is shown in the output as /usr/lib/jvm/java when the build is first launched, the maven.compiler.executable and maven.compiler.fork properties in the default pom.xml file ensure that JDK 8 will actually get used when building). It sounds like some additional properties just need to be added to your apt-maven-plugin configuration. Does adding the following properties work for you?
<configuration> ... <fork>true</fork> <executable>${env.OPENSHIFT_WILDFLY_DIR}usr/lib/jvm/jdk1.8.0_05/bin/javac</executable> </configuration>
-
4. Re: Openshift Wildfly 8.1 cartridge - JDK8 and maven build
remi.bantos Jun 12, 2014 4:43 PM (in response to fjuma)Hello Farah,
I had reproduced this issue in my own development environment (not int Openshift) using a JDK7 to run maven and after having performed all the steps described in your blog WildFly 8.1.0.Final on OpenShift - with JDK 8 support! to use JDK8 with the fork option.
I've figured out that i really need JAVA_HOME to be set to JDK8 for this plugin be correctly working: querydsl/apt-maven-plugin · GitHub
As use of JDK7 is hardcoded in mvn command script, i had not been able to build my application.
Several plugins, such as Surefire plugin, have a <jvm> element configuration which allows to specify a specific JDK with the forking option. However, this QueryDSL plugin i use does not seem to have such a configuration.
Here is an extract of Surefire documentation which describes <jvm> attribute.
jvm String 2.1 Option to specify the jvm (or path to the java executable) to use with the forking options. For the default, the jvm will be a new instance of the same VM as the one used to run Maven. JVM settings are not inherited from MAVEN_OPTS.
User property is: jvm.Thus, by default, this QueryDSL plugin uses the same JDK as the one specified in JAVA_HOME used by maven build.
Therefore, i would really need a way to override this JAVA_HOME setting for maven build in Wildfly 8.1 cartridge.
Thanks,
Remi
-
5. Re: Re: Openshift Wildfly 8.1 cartridge - JDK8 and maven build
fjuma Jun 12, 2014 7:44 PM (in response to remi.bantos)1 of 1 people found this helpfulThe properties mentioned in the blog post pertain to the maven plugin configured in the default pom.xml file. If the plugin you're using doesn't support a similar way to specify the JDK version using a fork option, it doesn't look like there's a way to get the build to work right now. (Note that the mvn script that hardcodes JAVA_HOME to JDK 7 is an OpenShift script that's not owned by the WildFly cartridge so there isn't really a way to override it. Instead, when using the maven plugin configured in the default pom.xml file, the maven.compiler.executable and maven.compiler.fork properties allow the correct JDK version to get used.)
As a workaround for now, you could build your WAR locally and push it to your git repo. Instructions for this can be found below (see "Method 2"):
http://openshift.github.io/documentation/oo_cartridge_guide.html#layout-and-deployment-options
-
6. Re: Openshift Wildfly 8.1 cartridge - JDK8 and maven build
remi.bantos Jun 13, 2014 6:22 AM (in response to fjuma)Ok, i'll be waiting for a change on OpenShift maven build, to run it with JAVA_HOME exported to something else than JDK7, as i would like to use OpenShift build functionnality.
Thanks
-
7. Re: Openshift Wildfly 8.1 cartridge - JDK8 and maven build
fjuma Jun 13, 2014 9:51 AM (in response to remi.bantos)The OpenShift team will update the mvn script once they provide JDK 8 support. You can create a bugzilla issue against OpenShift Online though if you'd like a way to override JAVA_HOME:
https://bugzilla.redhat.com/enter_bug.cgi?product=OpenShift%20Online