Jaskey Jaskey - 1 year ago 59
Java Question

How to make Maven use JDK1.8 instead of JDK1.6

I am new to maven, and I find that though I change the facet of the jdk of the project to 1.8, every time I "update maven",it will get back to jdk 1.6.

Why is that?

I installed jdk 1.8 in my windows, and I am using eclipse.

I read Specify JDK for Maven to use and add the following but it does not work.


Answer Source

The version of the JDK that maven will use is set in the maven-compiler-plugin like so:

      <source>1.8</source>   <!-- use java 8 -->

See Setting the -source and -target of the Java Compiler for more information.