Using different Java source version when running Maven2 build

爷,独闯天下 提交于 2019-12-02 05:55:32

问题


I'm attempting to run my Maven build using the usual:

mvn clean install

I'm getting a whole series of errors that read:

annotations are not supported in -source 1.3
(use -source 5 or higher to enable annotations)

How do I use -source 5 when performing the build. My JAVA_HOME is pointing to JDK 1.6.


回答1:


Add this to your 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>

It is also documented in the Maven FAQ.

For further information take a look at the Compiler Plugin documentation.




回答2:


it's in the pom.xml. you should have <source>1.3</source> change it to

<source>1.6</source> 


来源:https://stackoverflow.com/questions/5163872/using-different-java-source-version-when-running-maven2-build

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!