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>