Netty源码分析笔记之运行Netty 源码自带的例子example时,编译不通过

主要分享下,在运行netty源码自带的例子时,遇到的问题:

主要步骤如下:

    1、从git上下载好netty源码【netty-netty-4.1.6.Final】

    2、直接导入到Intellij idea里,

    3、运行example模块下的echo例子

报以下错误:

Netty源码分析笔记之运行Netty 源码自带的例子example时,编译不通过


很明显,缺少依赖包,当时感觉很纳闷,netty这么优秀的框架,为什么会缺少依赖包呢?

解决措施:

    在handler模块的pom文件里添加依赖

    

<dependency>
  <groupId>org.apache.tomcat</groupId>
  <artifactId>tomcat-jni</artifactId>
  <version>8.5.20</version>
</dependency>

<dependency>
  <groupId>org.eclipse.jetty.alpn</groupId>
  <artifactId>alpn-api</artifactId>
  <version>1.1.3.v20160715</version>
  <scope>provided</scope>
</dependency>

再次运行,

EchoServer

可以正常编译运行了,如下图所示:

Netty源码分析笔记之运行Netty 源码自带的例子example时,编译不通过

总之:

    对优秀框架,同样要有怀疑的态度。