【发布时间】:2014-07-28 18:11:33
【问题描述】:
我正在尝试使用通常的方式运行我的 Maven 构建:
mvn clean install
我收到一系列错误,内容如下:
annotations are not supported in -source 1.3
(use -source 5 or higher to enable annotations)
执行构建时如何使用 -source 5。我的 JAVA_HOME 指向 JDK 1.6。
【问题讨论】:
我正在尝试使用通常的方式运行我的 Maven 构建:
mvn clean install
我收到一系列错误,内容如下:
annotations are not supported in -source 1.3
(use -source 5 or higher to enable annotations)
执行构建时如何使用 -source 5。我的 JAVA_HOME 指向 JDK 1.6。
【问题讨论】:
将此添加到您的 pom.xml:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
它也记录在Maven FAQ。
如需了解更多信息,请查看Compiler Plugin documentation。
【讨论】:
它在 pom.xml 中。你应该把<source>1.3</source>改成
<source>1.6</source>
【讨论】: