日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

netty源码构建

發布時間:2023/12/20 编程问答 34 豆豆
生活随笔 收集整理的這篇文章主要介紹了 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=true

maven命令中跳過測試和檢查代碼。

使用IDEA導入項目,只需要導入根目錄下的pom.xml,其他子目錄的pom.xml不要去勾選,如common/dependency-reduced-pom.xml。

打開example目錄, 運行里面的例子,驗證是否構建成功,例如運行:io.netty.example.echo.EchoServer。

其他玩法

目標:

  • 可以直接在其他工程下,閱讀netty的源碼(而不是idea自動從jar包解壓出來展示)。
  • 除了可以看到netty本身自帶的注釋以外,還可以自己添加代碼注釋,方便后續閱讀。
  • 下載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進入項目設置:

    總結

    以上是生活随笔為你收集整理的netty源码构建的全部內容,希望文章能夠幫你解決所遇到的問題。

    如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。