Maven 安装:“-source 1.3 不支持注释" [英] Maven Install: "Annotations are not supported in -source 1.3"
本文介绍了Maven 安装:“-source 1.3 不支持注释"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我的项目上运行 mvn install
时,我发现它由于以下错误而失败:
When running mvn install
on my project, i see it fail due to the following errors:
C:Repositorieslahsrc estjavacomxxxqm estrunner estATest.java:[11,5] annotations are not supported in -source 1.3
(use -source 5 or higher to enable annotations)
@Test
C:Repositorieslahsrc estjavacomxxxqmcommon estBTest.java:[11,5] annotations are not supported in -source 1.3
(use -source 5 or higher to enable annotations)
@Test
我的 Maven 依赖项包括 jUnit 4.8
,但是并没有引用 1.3 的任何内容.
My Maven dependency includes jUnit 4.8
, however and has no reference to 1.3 anything.
什么会导致这些错误?请指教
What would cause these errors? Please advise
推荐答案
你需要通过使用maven-compiler-plugin来指定你的maven项目的源码版本.将以下内容添加到您的 pom 构建元素并设置适当的 java 源和目标级别.
You need to specify the source version of your maven project through the use of the maven-compiler-plugin. Add the following to your pom build element and set the appropriate java source and target levels.
<build>
<defaultGoal>install</defaultGoal>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
http://maven.apache.org/plugins/maven-compiler-plugin/
这篇关于Maven 安装:“-source 1.3 不支持注释"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文