I'm using Maven 2.2 on Solaris 10. When compiling my JAR project, in which I want to use a Java 6 compiler, I get compilation errors like …
[INFO] Compilation failure
/home/davea/selenium/src/main/java/com/cm/systems/selenium/util/TestSuite.java:[17,18] generics are not supported in -source 1.3
(use -source 5 or higher to enable generics) private Vector filesets = new Vector();
I have changed my $JAVA_HOME to point to my Java 6 installation (there is another Java 5 installation on the system) …
-bash-3.00$ java -version
java version "1.6.0_25"
Java(TM) SE Runtime Environment (build 1.6.0_25-b06)
Java HotSpot(TM) Server VM (build 20.0-b11, mixed mode)
-bash-3.00$ echo $JAVA_HOME
/home/davea/jdk1.6.0_25
Yet still the errors persist. What else do I need to do? Thanks, - Dave开发者_如何学Python
By default, the compiler plugin uses source=1.3 and target=1.3. You have to manually set it to 1.6:
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
精彩评论