首页 > Web开发 > 详细

netty github 导入 Eclipse

时间:2015-02-09 18:34:35      阅读:728      评论:0      收藏:0      [点我收藏+]

       最近看到netty框架后有了深入学习一下的想法,但是各种书籍材料还是太少,貌似只有一本netty in action 的英文版可以算的上是参考资料,其他的都不太推荐给大家了。所以最好的资料还是官网的资料。不过netty是一套开源的框架,所有资料都放在github上了,包括丰富的example包,所以要学习还是直接看例子跟代码来的快。

       首先,github的地址:https://github.com/netty/netty

       然后是安装的一些指南:http://netty.io/wiki/setting-up-development-environment.html(这个应该是最关键的一部分)

       官网推荐用IntelliJ IDEA环境,我这里用的是Eclipse。

       Eclipse+git的配置网上有很多文章,这里就不再多说。关键几步如下:

       1.clone项目

       2.项目拉下来后会有一个Working Directory,不要直接导入工作目录,否则要自行配置.project和.classpath文件,很麻烦。

      3.将clone下来的项目直接以maven项目格式导入Eclipse。

      理论上,上面3个步骤已经完成了所有工作,但是netty环境搭建还没有完成。目前netty的master已经到了5.x,官方的maven管理仍然用的是jdk6的版本,因此在install的时候会报莫名其妙的错误。官方的解决方案如下:

Set up Eclipse with M2E and Java 7

  1. Download os-maven-plugin and put it into <ECLIPSE_HOME>/plugins directory to work around the problem where m2e does not evaluate an extension specified in our pom.xml. (Unlike its name, it‘s both a Maven plugin and an Eclipse plugin.)
  2. Import the project via the ‘File -> Import... -> Existing Maven Projects‘ menu.
  3. Netty project Maven pom.xml settings dictate use of Java SE 1.6, while implicitly using Java 7 (1.7) features if present. This may result in compilation errors in Eclipse. There are two ways to work around this problem:
    1. Look in the ‘Window -> Preferences -> Installed JRE‘ menu:
      • Make sure you have Java 7 installation available under ‘Installed JRE‘
      • Map this Java 7 installation onto Java 6: ‘Installed JRE -> Execution Environments -> Java SE 1.6‘
    2. Alternatively, Java 7 JRE can be selected on per-project basis for each Netty module.

      到了这一步基本上netty的开发环境已经搭建好了,剩下的就是跟着example模块跑吧,当然想改源码也是没有问题的,随便玩吧

netty github 导入 Eclipse

原文:http://blog.csdn.net/hh544/article/details/43671701

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!