一 、配置git (未安装git, 可以先安装git)
git config --global core.autocrlf true
配置之后,git将会根据使用者的系统自动将下载项目中的换行符转换成系统的换行符,因为一个项目中的多个开发者使用的系统不同,对应的换行符不同,如果直接下载项目代码的话,编译netty项目会出现如下错误
...
D:\Knowledge\SOURCE\netty\netty-4.0\common\src\test\java\io\netty\util\ThreadDeathWatcherTest.java:0: File does not end with a newline.
D:\Knowledge\SOURCE\netty\netty-4.0\common\src\test\java\io\netty\util\ThreadDeathWatcherTest.java:0: invalid newline character (expected: CRLF)
D:\Knowledge\SOURCE\netty\netty-4.0\common\src\test\java\io\netty\util\UniqueNameTest.java:0: File does not end with a newline.
D:\Knowledge\SOURCE\netty\netty-4.0\common\src\test\java\io\netty\util\UniqueNameTest.java:0: invalid newline character (expected: CRLF)
Audit done.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
...
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-checkstyle-plugin:2.12.1:check (check-style) on project netty-common: Failed during checkstyle execution: There are 314 checkstyle errors. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
Process finished with exit code 1
二、git clone netty项目
netty项目网址:https://github.com/netty/netty
在git bash命令行下,使用如下命令 clone 项目
git clone https://github.com/netty/netty.git
三、 使用idea工具打开netty项目,编译netty (直接使用maven编译也是可以的)
输入以下命令编译
mvn clean package -DskipTests
结果,编译成功,可在target文件夹下找到对应的jar包