Maven - 使用-source 5或更高版本来启用...同时构建项目 [英] Maven - use -source 5 or higher to enable... while building the project

查看:103
本文介绍了Maven - 使用-source 5或更高版本来启用...同时构建项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从我们的svn下载了一个项目,现在我正在尝试使用Maven构建它(mvn clean install ...我的maven是Apache Maven 3.0.4)。不幸的是,当我尝试构建时,会发生以下错误。奇怪的是它报告了一些关于Java版本1.3的东西(我认为),当然我没有在我的笔记本电脑中安装它。我有 JAVA_HOME 设置为JDK 1.7,我的javac也是1.7版本...

I downloaded one project from our svn and now I am trying to build this using Maven (mvn clean install... my maven is Apache Maven 3.0.4). Unfortunately, when I try to build, the following error occurs. It is strange that it reports something (I think) about Java version 1.3, which of course I dont have installed in my laptop. I have JAVA_HOME setted to JDK 1.7, my javac is also in version 1.7 ...

请知道吗问题出在哪里?

Please do you know where is the problem?

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.0.2:compile (default-compile) on project irapi: Compilation failure: Compilation failure:
[ERROR] /home/jan/nutch/src/plugin/irapi/src/main/java/cz/cvut/fit/linkedtv/irapi/rest/MediaServer.java:[21,1] error: **annotations are not supported in -source 1.3**
[ERROR] 
[ERROR] (use -source 5 or higher to enable annotations)
[ERROR] /home/jan/nutch/src/plugin/irapi/src/main/java/cz/cvut/fit/linkedtv/irapi/solr/SolrQueryResponseConvertor.java:[35,26] error: **for-each loops are not supported in -source 1.3**


推荐答案

您必须为maven-compiler-plugin指定源配置参数,如下所示:

You must specify the source configuration parameter to the maven-compiler-plugin like this:

  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <configuration>
      <source>1.5</source>
    </configuration>
  </plugin>

参见设置Java编译器的-source和-target

这篇关于Maven - 使用-source 5或更高版本来启用...同时构建项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆