Invalid target release 1.8

I tried to deploy my application in OPENHIFT, but maven cannot compile it with an error:

invalid target release 1.8

my "build" action_hook:

export JAVA_HOME="${OPENSHIFT_DATA_DIR}jdk1.8.0_05" export PATH=${OPENSHIFT_DATA_DIR}jdk1.8.0_05/bin:$PATH cd $OPENSHIFT_REPO_DIR java -version mvn package -s .openshift/settings.xml -DskipTests=true 

RESULT

 java version "1.8.0_05" Java(TM) SE Runtime Environment (build 1.8.0_05-b13) Java HotSpot(TM) 64-Bit Server VM (build 25.5-b02, mixed mode) [devlt-chernihiv.rhcloud.com repo]\> mvn package -s .openshift/settings.xml -DskipTests=true [INFO] Scanning for projects... [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building LaserTag 0.0.1-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ sector --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] Copying 1 resource [INFO] Copying 0 resource [INFO] [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ sector --- [INFO] Changes detected - recompiling the module! [INFO] Compiling 5 source files to /var/lib/openshift/5601634589f5cfa11000006a/app-root/runtime/repo/target/classes [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 7.018s [INFO] Finished at: Tue Sep 22 11:27:06 EDT 2015 [INFO] Final Memory: 10M/113M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project sector: Fatal error compiling: invalid target release: 1.8 -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException 

then I use this script and see the problem:

 export JAVA_HOME=${OPENSHIFT_DATA_DIR}jdk1.8.0_05 export PATH=${OPENSHIFT_DATA_DIR}jdk1.8.0_05/bin:$PATH java -version 

java version "1.8.0_05"

Java (TM) SE Runtime Environment (build 1.8.0_05-b13)

HotSpot (TM) 64-bit Java Server Virtual Machine (build 25.5-b02, mixed mode)

 mvn --version | grep 'Java home' 

Java home: /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.85/jre

Java Home has been changed, but maven ignores the new java site. Please, help.

+4
source share
3 answers

You can use catrtridge WildFly. This cartridge has everything you need. Java8, spring boot triggers and admin panel.

+4
source

You should try using the java8 token in the .openshift / markers folder for your project, which should help make maven use the correct version. It is assumed that you are using one of the standard java cartridges, not a DIY cartridge.

+1
source

It looks like your mvn team is setting its own JAVA_HOME. Check the contents of "mvn" to see what it does.

0
source

Source: https://habr.com/ru/post/1238647/


All Articles