繁体   English   中英

运行Maven2构建时使用不同的Java源版本

[英]Using different Java source version when running Maven2 build

我试图使用通常的方式运行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文档

它在pom.xml中。 您应该将<source>1.3</source>更改为

<source>1.6</source> 

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM