Bug 1130718 - Wildfly 8.1.0: invalid target release: 1.8?
Summary: Wildfly 8.1.0: invalid target release: 1.8?
Status: CLOSED DUPLICATE of bug 1109980
Alias: None
Product: OpenShift Online
Classification: Red Hat
Component: Image
Version: 2.x
Hardware: Unspecified
OS: Unspecified
Target Milestone: ---
: ---
Assignee: Ben Parees
QA Contact: libra bugs
Depends On:
TreeView+ depends on / blocked
Reported: 2014-08-16 20:50 UTC by Harit Himanshu
Modified: 2015-05-15 00:44 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2014-08-16 23:48:43 UTC

Attachments (Terms of Use)

Description Harit Himanshu 2014-08-16 20:50:01 UTC
Description of problem:
OpenShift maven uses java 1.7 instead of java 1.8

Version-Release number of selected component (if applicable):

How reproducible:
I learnt that by default `wildfly 8.1.0` cartridge [supports][1] `JDK 8`

However, when I deploy my application, I see the following error  

    remote: Stopping wildfly cart
    remote: Repairing links for 1 deployments
    remote: Building git ref master, commit af5f0d3
    remote: Found pom.xml... attempting to build with mvn -e clean package -Popenshift -DskipTests
    remote: Apache Maven 3.0.4 (r1232336; 2012-12-18 14:36:37-0500)
    remote: Maven home: /usr/share/java/apache-maven-3.0.4
    remote: Java version: 1.7.0_65, vendor: Oracle Corporation
    remote: Java home: /usr/lib/jvm/java-1.7.0-openjdk-
    remote: Default locale: en_US, platform encoding: ANSI_X3.4-1968
    remote: OS name: linux, version: 2.6.32-431.23.3.el6.x86_64, arch: i386, family: unix
    remote: [INFO] Scanning for projects...
    remote: [INFO]
    remote: [INFO] ------------------------------------------------------------------------
    remote: [INFO] Building pennyapp 1.0-SNAPSHOT
    remote: [INFO] ------------------------------------------------------------------------
    remote: [INFO]
    remote: [INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) @ pennyapp ---
    remote: [INFO]
    remote: [INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ pennyapp ---
    remote: [debug] execute contextualize
    remote: [WARNING] Using platform encoding (ANSI_X3.4-1968 actually) to copy filtered resources, i.e. build is platform dependent!
    remote: [INFO] skip non existing resourceDirectory /var/lib/openshift/53ec289c5973ca0333000a6c/app-root/runtime/repo/src/main/resources
    remote: [INFO]
    remote: [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ pennyapp ---
    remote: [INFO] Changes detected - recompiling the module!
    remote: [WARNING] File encoding has not been set, using platform encoding ANSI_X3.4-1968, i.e. build is platform dependent!
    remote: [INFO] Compiling 1 source file to /var/lib/openshift/53ec289c5973ca0333000a6c/app-root/runtime/repo/target/classes
    remote: [INFO] ------------------------------------------------------------------------
    remote: [INFO] BUILD FAILURE
    remote: [INFO] ------------------------------------------------------------------------
    remote: [INFO] Total time: 5.602s
    remote: [INFO] Finished at: Sat Aug 16 00:54:13 EDT 2014
    remote: [INFO] Final Memory: 7M/111M
    remote: [INFO] ------------------------------------------------------------------------
    remote: [WARNING] The requested profile openshift could not be activated because it does not exist.
    remote: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project pennyapp: Fatal error compiling: invalid target release: 1.8 -> [Help 1]
    remote: [ERROR]
    remote: [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
    remote: [ERROR] Re-run Maven using the -X switch to enable full debug logging.
    remote: [ERROR]
    remote: [ERROR] For more information about the errors and possible solutions, please read the following articles:
    remote: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
    remote: An error occurred executing gear postreceive (exit code: 1)
    remote: Error message: CLIENT_ERROR: Failed to execute: control build for /var/lib/openshift/53ec289c5973ca0333000a6c/wildfly

As you can see the logs clearly say  

    remote: Java version: 1.7.0_65, vendor: Oracle Corporation

To confirm this, I logged into the Openshift box and see this

    [api-myapp.rhcloud.com 53ec5973ca0333000a6c]\> java -version
    java version "1.8.0_05"
    Java(TM) SE Runtime Environment (build 1.8.0_05-b13)
    Java HotSpot(TM) Server VM (build 25.5-b02, mixed mode)


    [api-myapp.rhcloud.com 53ec5973ca0333000a6c]\> mvn -version
    Apache Maven 3.0.4 (r1232336; 2012-12-18 14:36:37-0500)
    Maven home: /usr/share/java/apache-maven-3.0.4
    Java version: 1.7.0_65, vendor: Oracle Corporation
    Java home: /usr/lib/jvm/java-1.7.0-openjdk-
    Default locale: en_US, platform encoding: UTF-8
    OS name: "linux", version: "2.6.32-431.23.3.el6.x86_64", arch: "i386", family: "unix"


Maven uses java version `1.7.0_65`  


How do I tell maven to use java 1.8?  

I know a way on mac using command-line as  

    export JAVA_HOME=$(/usr/libexec/java_home)

But is there a better way, so that I do not have to fiddle around when setting up `Continuous Deployment`?  


**UPDATE - 1**  
I also see that `JAVA_HOME` is correctly set  

     echo $JAVA_HOME

**UPDATE - 2**  
Im my `pom.xml`, I have plugin defined as  




**UPDATE - 3**  
Some more pointers  

    [api-myapp.rhcloud.com repo]\> echo $PATH
    [api-myapp.rhcloud.com repo]\> which java
    [api-myapp.rhcloud.com repo]\> /usr/bin/java -version
    java version "1.7.0_65"
    OpenJDK Runtime Environment (rhel- u65-b17)
    OpenJDK Server VM (build 24.65-b04, mixed mode)
    [api-pennyapp.rhcloud.com repo]\> 

  [1]: https://community.jboss.org/people/fjuma/blog/2014/06/03/wildfly-810final-on-openshift--with-jdk-8-support

Steps to Reproduce:

Actual results:

Expected results:
I expect maven to pick java 1.8

Additional info:

Farah Juma asked me to add some properties (https://community.jboss.org/people/fjuma/blog/2014/06/03/wildfly-810final-on-openshift--with-jdk-8-support) to application git repo pom.xml.  

I added it to  
cd ~/app-root/repo/
[api-pennyapp.rhcloud.com repo]\> ls
pom.xml  README.md  shippable.yml  src	target  

But everytime I do new checkin, this gets overwritten  

How do I let maven use java 1.8 in OpenShift environment?

Comment 1 Ben Parees 2014-08-16 22:24:37 UTC

*** This bug has been marked as a duplicate of bug 1109980 ***

Comment 2 Harit Himanshu 2014-08-16 23:41:32 UTC
what's the resolution for this situation then? can we not use JAVA 8?

what should I need to do?

Comment 3 Ben Parees 2014-08-16 23:48:43 UTC
Not sure why you reopened this?  We have a bug to track this limitation which is what I duped this bug to.  I've replied with a potential work around there, and we can continue the discussion on that bug.

*** This bug has been marked as a duplicate of bug 1109980 ***

Note You need to log in before you can comment on or make changes to this bug.