I have JDK 1.8 installed and configured JAVA_HOME to JDK 1.8. I am using apache-maven-3.0.5. I have created a maven project and configured maven-compiler-plugin(3.3) <source>
and <target>
to 1.7.
The problem is if I use any Java 1.8 features like String.join()
or map.remove(key, value)
it is still compiling successfully even though I set compiler level to 1.7.
One thing I observed is if I point my JAVA_HOME to JDK 1.7 directory then it is throwing compilation errors.
But my expectation is even if we have JAVA_HOME pointing to JDK 1.8 when I set compiler level to 1.7 in my pom.xml it should obey that compiler level(1.7) and throw errors.
What am I missing?
PS: When I run from my Eclipse IDE it is using correct JDK(1.7) and giving errors. But when I run it from command-line i am running into this problem.