I am using maven and would like to compile my code using JDK 1.8.
So I installed JDK 1.8
Then ( this is on windows ) set the 'path' variable and also 'JAVA_HOME'
PATH=C:\construction\tools\ibm_sdk80\bin;C:\construction\tools\apache-maven-3.2.5\bin;
the java home:
C:\Users\satish.marathe>set JAVA_HOME
JAVA_HOME=C:\construction\tools\ibm_sdk80
java version give me:
C:\Users\satish.marathe>java -version
java version "1.8.0"
Java(TM) SE Runtime Environment (build pwa6480sr1fp10-20150711_01(SR1 FP10))
IBM J9 VM (build 2.8, JRE 1.8.0 Windows 7 amd64-64 Compressed References 20150630_255633 (JIT enabled, AOT enabled)
J9VM - R28_jvm.28_20150630_1742_B255633
JIT - tr.r14.java_20150625_95081.01
GC - R28_jvm.28_20150630_1742_B255633_CMPRSS
J9CL - 20150630_255633)
JCL - 20150711_01 based on Oracle jdk8u51-b15
javac version tells me :
C:\Users\satish.marathe>javac -version
javac 1.8.0-internal
So everything seems to point to java 1.8
Now I compile my project using :
mvn clean install
However when I check the compiled classes I am seeing that the major version is 51 - which means it is Java 1.7
For those who would like to know how the java version is found in a class file ! :)
javap -verbose <<your_package>>.<<your_class>> | findStr "major"
EDIT1:
i forgot to include output of maven -version so here it is:
C:>mvn -version Apache Maven 3.2.5 (12a6b3acb947671f09b81f49094c53f426d8cea1; 2014-12-14T22:59:23+05:30)
Maven home: C:\construction\tools\apache-maven-3.2.5\bin..
Java version: 1.8.0, vendor: IBM Corporation
Java home: C:\construction\tools\ibm_sdk80\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "amd64", family: "dos"
C:>
OK - so my question is :
I do not have any entry for maven_compiler_plugin in my pom
so is that required ?
without that entry - shouldnt maven simply pick my java version as 1.8 from system and compile the code ( which it does not seem to be doing apparently )
Thanks