netty github 导入 Eclipse

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

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

然后是安装的一些指南:(这个应该是最关键的一部分)

官网推荐用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 7Download 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 ourpom.xml. (Unlike its name, it’s both a Maven plugin and an Eclipse plugin.)Import the project via the ‘File -> Import… -> Existing Maven Projects’ menu.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: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’Alternatively, Java 7 JRE can be selected on per-project basis for each Netty module.

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

在开始时却总是不厌其烦地渗透入生活的缝隙,

netty github 导入 Eclipse

相关文章:

你感兴趣的文章:

标签云: