【发布时间】:2014-11-21 20:53:34
【问题描述】:
我有一个为 java 1.7 编写的源代码。我想为 java 1.6 编译它。如果我理解正确,我需要使用选项 -source 1.7 -target 1.6
我正在使用 Maven2 和 Netbeans (8.0)。所以,我尝试了:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<configuration>
<source>1.7</source>
<target>1.6</target>
<compilerArguments>
<bootclasspath>/usr/lib/jvm/java-6-openjdk-amd64/jre/lib/rt.jar</bootclasspath>
</compilerArguments>
</configuration>
</plugin>
但我收到了javacTask: source release 1.7 requires target release 1.7
我读到有些人使用 eclipse 编译器来使其工作,但是如果我使用的是 Netbeans,我该怎么做呢?
非常感谢您的帮助
【问题讨论】: