When I do not define something as follows in my pom.xml file, where on my system is it defined for Maven which version of Java JDK to use while compiling (I have several versions installed on my system, JAVA_HOME
points to one of them)?
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
</plugins>
</build>
Maven doc says
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:
Source: http://maven.apache.org/plugins/maven-compiler-plugin/index.html
Thanks nachteil for pointing it out.
You must define a property in your maven setting.xml file. The property is your second javac path.(D:\dev\java\ibm\java1.6.0\bin\javac)After use this property for maven-compiler-plugin in your pom file.
setting.xml
pom.xml
From maven compiler plugin doucemntation:
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