netty源码构建
netty源碼構建
構建步驟
github源代碼地址:https://github.com/netty/netty。
使用git clone:git clone git@github.com:netty/netty.git。
$ git clone git@github.com:netty/netty.git Cloning into 'netty'... Warning: Permanently added the RSA host key for IP address '192.30.255.112' to the list of known hosts. remote: Enumerating objects: 67, done. remote: Counting objects: 100% (67/67), done. remote: Compressing objects: 100% (40/40), done. remote: Total 301597 (delta 11), reused 44 (delta 1), pack-reused 301530 Receiving objects: 100% (301597/301597), 64.61 MiB | 568.00 KiB/s, done. Resolving deltas: 100% (128988/128988), done. Checking out files: 100% (3100/3100), done.下載后的源碼目錄如下:
$ ls -a ./ LICENSE.txt ../ microbench/ .fbprefs mvnw* .git/ mvnw.cmd .gitattributes nohttp-checkstyle.xml .github/ nohttp-checkstyle-suppressions.xml .gitignore NOTICE.txt .idea/ pom.xml .lgtm.yml README.md .mvn/ resolver/ all/ resolver-dns/ bom/ resolver-dns-native-macos/ buffer/ run-example.sh* codec/ SECURITY.md codec-dns/ tarball/ codec-haproxy/ target/ codec-http/ testsuite/ codec-http2/ testsuite-autobahn/ codec-memcache/ testsuite-http2/ codec-mqtt/ testsuite-native-image/ codec-redis/ testsuite-native-image-client/ codec-smtp/ testsuite-osgi/ codec-socks/ testsuite-shading/ codec-stomp/ transport/ codec-xml/ transport-blockhound-tests/ common/ transport-native-epoll/ CONTRIBUTING.md transport-native-kqueue/ dev-tools/ transport-native-unix-common/ docker/ transport-native-unix-common-tests/ example/ transport-rxtx/ handler/ transport-sctp/ handler-proxy/ transport-udt/ license/一個標準的maven工程。
可以注釋掉xml中一下test工程:
... ...<module>tarball</module><module>transport</module> <!-- <module>transport-native-unix-common-tests</module>--><module>transport-native-unix-common</module><module>transport-native-epoll</module><module>transport-native-kqueue</module><module>transport-rxtx</module><module>transport-sctp</module><module>transport-udt</module><module>handler</module><module>handler-proxy</module><module>example</module> <!-- <module>testsuite</module>--> <!-- <module>testsuite-autobahn</module>--> <!-- <module>testsuite-http2</module>--> <!-- <module>testsuite-osgi</module>--> <!-- <module>testsuite-shading</module>--> <!-- <module>testsuite-native-image</module>--> <!-- <module>testsuite-native-image-client</module>--> <!-- <module>transport-blockhound-tests</module>--><module>microbench</module><module>bom</module></modules> ... ...下面使用maven對項目進行構建:
$ mvn clean install -Dmaven.test.skip=true -Dcheckstyle.skip=truemaven命令中跳過測試和檢查代碼。
使用IDEA導入項目,只需要導入根目錄下的pom.xml,其他子目錄的pom.xml不要去勾選,如common/dependency-reduced-pom.xml。
打開example目錄, 運行里面的例子,驗證是否構建成功,例如運行:io.netty.example.echo.EchoServer。
其他玩法
目標:
下載netty-all-4.1.54.Final-sources.jar,然后解壓,這里解壓后的目錄為C:\development\project\netty-all-4.1.54.Final-sources。
然后在IDEA中給netty-all-4.1.54.Final.jar添加源碼關聯,快捷鍵ctl+shift+alt+s進入項目設置:
總結
- 上一篇: 移相全桥
- 下一篇: 消息模板java开发_公众号发送消息模板