我正在使用嵌入式jetty服务器来构建战争,我通过eclipse运行maven clean,然后使用maven安装。我得到了一堆“不支持”的错误
\RoleDao.java:[86,13] generics are not supported in -source 1.3
(use -source 5 or higher to enable generics)
public List<Role> findAllRoles()
UserAuth.java:[44,1] annotations are not supported in -source 1.3
(use -source 5 or higher to enable annotations)
@SuppressWarnings("deprecation")
有人有想法吗?感谢
答案 0 :(得分:1)
错误消息指出您定义的语言级别为1.3。这是旧版本的Maven编译器插件(如2.0)的默认设置。升级到更新的版本,如2.3.2甚至最新的2.5.1,默认值为1.5,它应该可以正常工作。
当你在它的同时也升级到最新版本的Maven(3.0.4),以便这些新版本的Maven编译器插件是默认版本。
答案 1 :(得分:1)
Manfred指出这是默认值的问题。要摆脱这个讨厌的错误,您可以升级maven版本,maven-compiler-plugin版本或在您的pom.xml中配置版本
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<source>1.5</source>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
然后将来自source
的值作为-source参数传递给编译器,以显示接受的值,查看此页面javac并搜索 -source release 强>