maven - 在eclipse的maven项目中使用泛型 [英] maven - use generics in a eclipse's maven project

查看:167
本文介绍了maven - 在eclipse的maven项目中使用泛型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个由eclipse IDE的archtype插件生成的maven网站项目。问题是当我需要使用泛型或Java 5或6的任何东西时,我将项目编译器改为1.6,并且在包资源管理器中的项目图标上有一个错误标记,但一切都很好。我认为这是maven的原因,但我不知道如何摆脱它。



谢谢

解决方案

不要忘记配置maven -compiler-plugin:

 < plugin> 
< groupId> org.apache.maven.plugins< / groupId>
< artifactId> maven-compiler-plugin< / artifactId>
<! - 锁定用于构建重现性的插件版本 - >
< version> 2.0.2< / version>
< configuration>
< source> 1.6< / source>
< target> 1.6< / target>
< / configuration>
< / plugin>


I have a maven website project generated by archtype plugin with eclipse IDE. The problem is when i need to use generics or any thing of java 5 or 6, i changed the project compiler to 1.6 and i got a error mark on the project icon in the package explorer but everything is fine. I think it is cause by maven but I dont know how to get rid of it.

Thank you

解决方案

Don't forget to configure the maven-compiler-plugin:

  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <!-- Lock down plugin version for build reproducibility -->
    <version>2.0.2</version>
    <configuration>
      <source>1.6</source>
      <target>1.6</target>
    </configuration>
  </plugin>

这篇关于maven - 在eclipse的maven项目中使用泛型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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