1、环境要求
Maven、Git、JDK、Eclipse
2、从Netty的Git库拉取源码到本地,https://github.com/netty/netty
3、打开windows的命令提示符进入源码文件夹下通过 mvn clean compile -Dcheckstyle.skip=true -Dtest 命令进行编译
4、问题解决
1)Failure to transfer io.netty:netty-tcnative:jar:${tcnative.classifier}:2.0.3.Final
根据操作系统探测tcnative的classifier,我们需要进入netty-parent的pom.xml将下面这行注释掉
<!-- <tcnative.classifier>${os.detected.classifier}</tcnative.classifier> -->
并且在其他子模块的pom.xml中查找如下代码注释掉
<!-- <classifier>${tcnative.classifier}</classifier> -->
在同一个dependency中如果不存在下面代码的请加上,存在部分子模块有而部分没有的情况
<version>${tcnative.version}</version>
2)Plugin execution not covered by lifecycle configuration: org.codehaus.mojo:build-helper-maven-plugin:1.10:add- source (execution: add-source, phase: generate-sources)
该问题我们需要在报错的子模块的pom.xml中的插件组标签<plugins></plugins>外层加上一组<pluginManagement></pluginManagement>标签,如下所示
添加前:
<plugins>
<plugin>
.......
</plugin>
</plugins>
添加后:
<pluginManagement>
<plugins>
<plugin>
......
</plugin>
</plugins>
</pluginManagement>
对于netty-parent的pom.xml需要通过同样的办法处理,但我在处理的时候发现在这里包含两个<plugins>,第二个的外层已经存在<pluginManagement>标签,而第一个没有,这时如果在第一个外层加上<pluginManagement>会报错,最后的处理办法是将两个<plugins>合并成一个,然后再外层添加<pluginManagement>即可。
5、编译完成之后通过Eclipse导入Maven项目的方式导入。