Maven的安装:"注解不-source 1.3&QUOT的支持; [英] Maven Install: "Annotations are not supported in -source 1.3"

查看:170
本文介绍了Maven的安装:"注解不-source 1.3&QUOT的支持;的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在运行 MVN安装在我的项目,我看到它会由于以下错误:

When running mvn install on my project, i see it fail due to the following errors:

C:\Repositories\blah\src\test\java\com\xxx\qm\testrunner\test\ATest.java:[11,5] annotations are not supported in -source 1.3
(use -source 5 or higher to enable annotations)
    @Test

C:\Repositories\blah\src\test\java\com\xxx\qm\common\test\BTest.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的编译器插件来指定Maven项目的源代码版本。以下添加到您的POM build元素,并设置相应的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>

<一个href=\"http://maven.apache.org/plugins/maven-compiler-plugin/\">http://maven.apache.org/plugins/maven-compiler-plugin/

这篇关于Maven的安装:&QUOT;注解不-source 1.3&QUOT的支持;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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