Where is the JDK version to be used by Maven compiler specified?

Maven doc says

The Compiler Plugin is used to compile the sources of your project. The default compiler is javac and is used to compile Java sources. Also note that at present the default source setting is 1.5 and the default target setting is 1.5, independently of the JDK you run Maven with. If you want to change these defaults, you should set source and target as described in Setting the -source and -target of the Java Compiler.

ref: http://maven.apache.org/plugins/maven-compiler-plugin/index.html

There is this interesting thread on Maven's Jira Change default source level to 1.5


EDIT:
Update for Maven 3.0 and later:

The Compiler Plugin is used to compile the sources of your project. Since 3.0, the default compiler is javax.tools.JavaCompiler (if you are using java 1.6) and is used to compile Java sources. If you want to force the plugin using javac, you must configure the plugin option forceJavacCompilerUse.

Source: http://maven.apache.org/plugins/maven-compiler-plugin/index.html

Thanks nachteil for pointing it out.


From maven compiler plugin doucemntation:

Since 3.0, the default compiler is javax.tools.JavaCompiler (if you are using java 1.6) and is used to compile Java sources. If you want to force the plugin using javac, you must configure the plugin option forceJavacCompilerUse.

I found this post via search engine and I think it is worth updating. Also: the -target and -source options do not affect the compiler itself, but rather the way it handles source code and produces output byte code.


simply use properties

<properties>
    <maven.compiler.target>1.7</maven.compiler.target>
    <maven.compiler.source>1.7</maven.compiler.source>
    <maven.test.skip>true</maven.test.skip>
</properties>