8 Replies Latest reply on Jun 16, 2014 3:59 PM by Rémi Bantos

    Openshift Wildfly 8.1 cartridge - JDK8 and maven build

    Rémi Bantos Newbie

      Hello,

       

      I have an issue with maven build of my application which uses JDK8 with a Wildfly 8.1 cartridge.

       

      I use QueryDSL apt-maven-plugin which performs code generation during build.

       

      This plugin seems to require JAVA_HOME to be set to the same JDK as the one used in application prior to maven build launch. (I have not been able to find a plugin configuration to declare a specific JDK use for it)

       

      Indeed, I have a language level compilation error (using a Java 8 lambda expression) that i can reproduce on my personal development environment by launching maven build with a default JDK7 installed and after having applied steps described in this post: (which describes how to configure maven build in Wildfly 8.1 cartridge to use JDK8) WildFly 8.1.0.Final on OpenShift - with JDK 8 support!

       

      I have noticed that the following maven script  is used in Openshift VM during build:

       

      export JAVA_HOME=/usr/lib/jvm/java

      export JAVACMD=$JAVA_HOME/bin/java

      export M2_HOME=/usr/share/java/apache-maven-3.0.4

      exec $M2_HOME/bin/$prog "$@"

       

      /usr/lib/jvm/java is a JDK7. So i cannot override JAVA_HOME in my application to use JDK8 installation described in this post.

       

      Here is the exception I have due to this build configuration issue:

      [INFO] --- apt-maven-plugin:1.1.1:process (default) @ catalog ---

      /var/lib/openshift/538fb4fe4382ecd4c00002c7/app-root/runtime/repo/catalog/src/main/java/org/rembx/jeeshop/catalog/CatalogItemFinder.java:45: error: illegal start of expression

              results.forEach((catalogItem) -> catalogItem.setLocalizedPresentation(locale));

                                             ^

      1 error

       

      Thanks for your help