zookeeper源码阅读——导入源码到IDEA中(2019-11-15)

windows安装ant

下载ant:http://archive.apache.org/dist/ant/binaries/

下载apache-ant-1.10.5-bin.tar.gz,解压缩,然后配置环境变量ANT_HOME,把$ANT_HOME/bin加入到PATH环境变量里去。
ant -version检查一下ant的版本号,是否安装成功

C:\Users\admin>ant -version
Apache Ant(TM) version 1.10.5 compiled on July 10 2018

C:\Users\admin>

编译zookeeper

去官网http://archive.apache.org/dist/zookeeper/zookeeper-3.4.5/下载zookeeper-3.4.5-tar.gz,解压缩,在zk目录下,然后进去执行ant eclipse命令

PS D:\development\ZK\zookeeper-3.4.5> ant eclipse
Buildfile: D:\development\ZK\zookeeper-3.4.5\build.xml

ant-eclipse-download:
      [get] Getting: http://downloads.sourceforge.net/project/ant-eclipse/ant-eclipse/1.0/ant-eclipse-1.0.bin.tar.bz2
      [get] To: D:\development\ZK\zookeeper-3.4.5\src\java\ant-eclipse-1.0.bin.tar.bz2
      [get] http://downloads.sourceforge.net/project/ant-eclipse/ant-eclipse/1.0/ant-eclipse-1.0.bin.tar.bz2 moved to https://nchc.dl.sourceforge.net/project/ant-eclipse/ant-eclipse/1.0/ant-eclipse-1.0.bin.tar.bz2
  [bunzip2] Expanding ant-eclipse-1.0.bin.tar.bz2 to D:\development\ZK\zookeeper-3.4.5\src\java\ant-eclipse-1.0.bin.tar
    [untar] Expanding: D:\development\ZK\zookeeper-3.4.5\src\java\ant-eclipse-1.0.bin.tar into D:\development\ZK\zookeeper-3.4.5\src\java
   [delete] Deleting: D:\development\ZK\zookeeper-3.4.5\src\java\ant-eclipse-1.0.bin.tar
   [delete] Deleting: D:\development\ZK\zookeeper-3.4.5\src\java\ant-eclipse-1.0.bin.tar.bz2

init:
    [mkdir] Created dir: D:\development\ZK\zookeeper-3.4.5\build\classes
    [mkdir] Created dir: D:\development\ZK\zookeeper-3.4.5\build\lib
    [mkdir] Created dir: D:\development\ZK\zookeeper-3.4.5\build\package\lib
    [mkdir] Created dir: D:\development\ZK\zookeeper-3.4.5\build\test\lib

ivy-download:
      [get] Getting: http://repo2.maven.org/maven2/org/apache/ivy/ivy/2.2.0/ivy-2.2.0.jar
      [get] To: D:\development\ZK\zookeeper-3.4.5\src\java\lib\ivy-2.2.0.jar

ivy-taskdef:

ivy-init:

ivy-retrieve:
[ivy:retrieve] :: Ivy 2.2.0 - 20100923230623 :: http://ant.apache.org/ivy/ ::
[ivy:retrieve] :: loading settings :: file = D:\development\ZK\zookeeper-3.4.5\ivysettings.xml
[ivy:retrieve] :: resolving dependencies :: org.apache.zookeeper#zookeeper;3.4.5
[ivy:retrieve]  confs: [default]
[ivy:retrieve]  found org.slf4j#slf4j-api;1.6.1 in maven2
[ivy:retrieve]  found org.slf4j#slf4j-log4j12;1.6.1 in maven2
[ivy:retrieve]  found log4j#log4j;1.2.15 in maven2
[ivy:retrieve]  found jline#jline;0.9.94 in maven2
[ivy:retrieve]  found org.jboss.netty#netty;3.2.2.Final in maven2
[ivy:retrieve] downloading http://repo1.maven.org/maven2/org/slf4j/slf4j-api/1.6.1/slf4j-api-1.6.1.jar ...
[ivy:retrieve] ... (24kB)
[ivy:retrieve] .. (0kB)
[ivy:retrieve]  [SUCCESSFUL ] org.slf4j#slf4j-api;1.6.1!slf4j-api.jar (1308ms)
[ivy:retrieve] downloading http://repo1.maven.org/maven2/org/slf4j/slf4j-log4j12/1.6.1/slf4j-log4j12-1.6.1.jar ...
[ivy:retrieve] .. (9kB)
[ivy:retrieve] .. (0kB)
[ivy:retrieve]  [SUCCESSFUL ] org.slf4j#slf4j-log4j12;1.6.1!slf4j-log4j12.jar (1103ms)
[ivy:retrieve] downloading http://repo1.maven.org/maven2/log4j/log4j/1.2.15/log4j-1.2.15.jar ...
[ivy:retrieve] .....
[ivy:retrieve] .......
[ivy:retrieve] . (382kB)
[ivy:retrieve] .. (0kB)
[ivy:retrieve]  [SUCCESSFUL ] log4j#log4j;1.2.15!log4j.jar (5033ms)
[ivy:retrieve] downloading http://repo1.maven.org/maven2/jline/jline/0.9.94/jline-0.9.94.jar ...
[ivy:retrieve] .... (85kB)
[ivy:retrieve] .. (0kB)
[ivy:retrieve]  [SUCCESSFUL ] jline#jline;0.9.94!jline.jar (1853ms)
[ivy:retrieve] downloading http://repo1.maven.org/maven2/org/jboss/netty/netty/3.2.2.Final/netty-3.2.2.Final.jar ...
[ivy:retrieve] .....
[ivy:retrieve] ......
[ivy:retrieve] .....
[ivy:retrieve] ......
[ivy:retrieve] ... (767kB)
[ivy:retrieve] .. (0kB)
[ivy:retrieve]  [SUCCESSFUL ] org.jboss.netty#netty;3.2.2.Final!netty.jar (8484ms)
[ivy:retrieve] :: resolution report :: resolve 16886ms :: artifacts dl 17794ms
        ---------------------------------------------------------------------
        |                  |            modules            ||   artifacts   |
        |       conf       | number| search|dwnlded|evicted|| number|dwnlded|
        ---------------------------------------------------------------------
        |      default     |   5   |   5   |   5   |   0   ||   5   |   5   |
        ---------------------------------------------------------------------
[ivy:retrieve] :: retrieving :: org.apache.zookeeper#zookeeper
[ivy:retrieve]  confs: [default]
[ivy:retrieve]  5 artifacts copied, 0 already retrieved (1269kB/95ms)

jute:
    [javac] Compiling 39 source files to D:\development\ZK\zookeeper-3.4.5\build\classes
    [javac] 警告: [options] 未与 -source 1.5 一起设置引导类路径
    [javac] 警告: [options] 源值1.5已过时, 将在未来所有发行版中删除
    [javac] 警告: [options] 目标值1.5已过时, 将在未来所有发行版中删除
    [javac] 警告: [options] 要隐藏有关已过时选项的警告, 请使用 -Xlint:-options。
    [javac] 注: 某些输入文件使用了未经检查或不安全的操作。
    [javac] 注: 有关详细信息, 请使用 -Xlint:unchecked 重新编译。
    [javac] 4 个警告

compile_jute_uptodate:

compile_jute:

ver-gen:
    [javac] Compiling 1 source file to D:\development\ZK\zookeeper-3.4.5\build\classes
    [javac] 警告: [options] 未与 -source 1.5 一起设置引导类路径
    [javac] 警告: [options] 源值1.5已过时, 将在未来所有发行版中删除
    [javac] 警告: [options] 目标值1.5已过时, 将在未来所有发行版中删除
    [javac] 警告: [options] 要隐藏有关已过时选项的警告, 请使用 -Xlint:-options。
    [javac] 4 个警告

svn-revision:
    [mkdir] Created dir: D:\development\ZK\zookeeper-3.4.5\.revision
     [exec]
     [exec] D:\development\ZK\zookeeper-3.4.5>echo off
     [exec] svn: '.' is not a working copy
     [exec] Result: 1

version-info:
     [java] Unknown REVISION number, using -1

build-generated:
    [javac] Compiling 56 source files to D:\development\ZK\zookeeper-3.4.5\build\classes
    [javac] 警告: [options] 未与 -source 1.5 一起设置引导类路径
    [javac] 警告: [options] 源值1.5已过时, 将在未来所有发行版中删除
    [javac] 警告: [options] 目标值1.5已过时, 将在未来所有发行版中删除
    [javac] 警告: [options] 要隐藏有关已过时选项的警告, 请使用 -Xlint:-options。
    [javac] 4 个警告

ivy-retrieve-test:
[ivy:retrieve] :: resolving dependencies :: org.apache.zookeeper#zookeeper;3.4.5
[ivy:retrieve]  confs: [test]
[ivy:retrieve]  found junit#junit;4.8.1 in maven2
[ivy:retrieve]  found org.mockito#mockito-all;1.8.2 in maven2
[ivy:retrieve]  found checkstyle#checkstyle;5.0 in maven2
[ivy:retrieve]  found antlr#antlr;2.7.6 in maven2
[ivy:retrieve]  found commons-beanutils#commons-beanutils-core;1.7.0 in maven2
[ivy:retrieve]  found commons-collections#commons-collections;2.0 in maven2
[ivy:retrieve]  found commons-cli#commons-cli;1.0 in maven2
[ivy:retrieve]  found commons-lang#commons-lang;1.0 in maven2
[ivy:retrieve]  found commons-logging#commons-logging;1.0.3 in maven2
[ivy:retrieve]  found com.google.collections#google-collections;0.9 in maven2
[ivy:retrieve] downloading http://repo1.maven.org/maven2/junit/junit/4.8.1/junit-4.8.1.jar ...
[ivy:retrieve] ......... (231kB)
[ivy:retrieve] .. (0kB)
[ivy:retrieve]  [SUCCESSFUL ] junit#junit;4.8.1!junit.jar (2378ms)
[ivy:retrieve] downloading http://repo1.maven.org/maven2/org/mockito/mockito-all/1.8.2/mockito-all-1.8.2.jar ...
[ivy:retrieve] ............
[ivy:retrieve] ...............
[ivy:retrieve] ............ (1315kB)
[ivy:retrieve] .. (0kB)
[ivy:retrieve]  [SUCCESSFUL ] org.mockito#mockito-all;1.8.2!mockito-all.jar (5638ms)
[ivy:retrieve] downloading http://repo1.maven.org/maven2/checkstyle/checkstyle/5.0/checkstyle-5.0.jar ...
[ivy:retrieve] ................. (601kB)
[ivy:retrieve] .. (0kB)
[ivy:retrieve]  [SUCCESSFUL ] checkstyle#checkstyle;5.0!checkstyle.jar (2482ms)
[ivy:retrieve] downloading http://repo1.maven.org/maven2/antlr/antlr/2.7.6/antlr-2.7.6.jar ...
[ivy:retrieve] ............... (433kB)
[ivy:retrieve] .. (0kB)
[ivy:retrieve]  [SUCCESSFUL ] antlr#antlr;2.7.6!antlr.jar (1843ms)
[ivy:retrieve] downloading http://repo1.maven.org/maven2/commons-beanutils/commons-beanutils-core/1.7.0/commons-beanutils-core-1.7.0.jar ...
[ivy:retrieve] ....... (164kB)
[ivy:retrieve] .. (0kB)
[ivy:retrieve]  [SUCCESSFUL ] commons-beanutils#commons-beanutils-core;1.7.0!commons-beanutils-core.jar (1329ms)
[ivy:retrieve] downloading http://repo1.maven.org/maven2/commons-cli/commons-cli/1.0/commons-cli-1.0.jar ...
[ivy:retrieve] ... (29kB)
[ivy:retrieve] .. (0kB)
[ivy:retrieve]  [SUCCESSFUL ] commons-cli#commons-cli;1.0!commons-cli.jar (1151ms)
[ivy:retrieve] downloading http://repo1.maven.org/maven2/commons-logging/commons-logging/1.0.3/commons-logging-1.0.3.jar ...
[ivy:retrieve] ... (30kB)
[ivy:retrieve] .. (0kB)
[ivy:retrieve]  [SUCCESSFUL ] commons-logging#commons-logging;1.0.3!commons-logging.jar (1186ms)
[ivy:retrieve] downloading http://repo1.maven.org/maven2/com/google/collections/google-collections/0.9/google-collections-0.9.jar ...
[ivy:retrieve] ................... (557kB)
[ivy:retrieve] .. (0kB)
[ivy:retrieve]  [SUCCESSFUL ] com.google.collections#google-collections;0.9!google-collections.jar (1844ms)
[ivy:retrieve] downloading http://repo1.maven.org/maven2/commons-collections/commons-collections/2.0/commons-collections-2.0.jar ...
[ivy:retrieve] .... (88kB)
[ivy:retrieve] .. (0kB)
[ivy:retrieve]  [SUCCESSFUL ] commons-collections#commons-collections;2.0!commons-collections.jar (1118ms)
[ivy:retrieve] downloading http://repo1.maven.org/maven2/commons-lang/commons-lang/1.0/commons-lang-1.0.jar ...
[ivy:retrieve] ... (62kB)
[ivy:retrieve] .. (0kB)
[ivy:retrieve]  [SUCCESSFUL ] commons-lang#commons-lang;1.0!commons-lang.jar (1106ms)
[ivy:retrieve] :: resolution report :: resolve 18835ms :: artifacts dl 20100ms
[ivy:retrieve]  :: evicted modules:
[ivy:retrieve]  commons-logging#commons-logging;1.0 by [commons-logging#commons-logging;1.0.3] in [test]
[ivy:retrieve]  junit#junit;3.7 by [junit#junit;4.8.1] in [test]
        ---------------------------------------------------------------------
        |                  |            modules            ||   artifacts   |
        |       conf       | number| search|dwnlded|evicted|| number|dwnlded|
        ---------------------------------------------------------------------
        |       test       |   12  |   10  |   10  |   2   ||   10  |   10  |
        ---------------------------------------------------------------------
[ivy:retrieve] :: retrieving :: org.apache.zookeeper#zookeeper
[ivy:retrieve]  confs: [test]
[ivy:retrieve]  10 artifacts copied, 0 already retrieved (3515kB/108ms)

eclipse:
[ivy:resolve] DEPRECATED: 'ivy.conf.file' is deprecated, use 'ivy.settings.file' instead
[ivy:resolve] :: loading settings :: file = D:\development\ZK\zookeeper-3.4.5\ivysettings.xml
[ivy:resolve] DEPRECATED: useOrigin option is deprecated when calling resolve, use useOrigin setting on the cache implementation instead
[ivy:resolve] :: resolving dependencies :: org.apache.zookeeper#zookeeper;3.4.5
[ivy:resolve]   confs: [test]
[ivy:resolve]   found junit#junit;4.8.1 in maven2
[ivy:resolve]   found org.mockito#mockito-all;1.8.2 in maven2
[ivy:resolve]   found checkstyle#checkstyle;5.0 in maven2
[ivy:resolve]   found antlr#antlr;2.7.6 in maven2
[ivy:resolve]   found commons-beanutils#commons-beanutils-core;1.7.0 in maven2
[ivy:resolve]   found commons-collections#commons-collections;2.0 in maven2
[ivy:resolve]   found commons-cli#commons-cli;1.0 in maven2
[ivy:resolve]   found commons-lang#commons-lang;1.0 in maven2
[ivy:resolve]   found commons-logging#commons-logging;1.0.3 in maven2
[ivy:resolve]   found com.google.collections#google-collections;0.9 in maven2
[ivy:resolve] :: resolution report :: resolve 195ms :: artifacts dl 25ms
[ivy:resolve]   :: evicted modules:
[ivy:resolve]   commons-logging#commons-logging;1.0 by [commons-logging#commons-logging;1.0.3] in [test]
[ivy:resolve]   junit#junit;3.7 by [junit#junit;4.8.1] in [test]
        ---------------------------------------------------------------------
        |                  |            modules            ||   artifacts   |
        |       conf       | number| search|dwnlded|evicted|| number|dwnlded|
        ---------------------------------------------------------------------
        |       test       |   12  |   0   |   0   |   2   ||   10  |   0   |
        ---------------------------------------------------------------------
[ivy:cachepath] :: resolving dependencies :: org.apache.zookeeper#zookeeper;3.4.5
[ivy:cachepath]         confs: [default]
[ivy:cachepath]         found org.slf4j#slf4j-api;1.6.1 in maven2
[ivy:cachepath]         found org.slf4j#slf4j-log4j12;1.6.1 in maven2
[ivy:cachepath]         found log4j#log4j;1.2.15 in maven2
[ivy:cachepath]         found jline#jline;0.9.94 in maven2
[ivy:cachepath]         found org.jboss.netty#netty;3.2.2.Final in maven2
[ivy:cachepath] :: resolution report :: resolve 148ms :: artifacts dl 12ms
        ---------------------------------------------------------------------
        |                  |            modules            ||   artifacts   |
        |       conf       | number| search|dwnlded|evicted|| number|dwnlded|
        ---------------------------------------------------------------------
        |      default     |   5   |   0   |   0   |   0   ||   5   |   0   |
        ---------------------------------------------------------------------
[ivy:cachepath] :: resolving dependencies :: org.apache.zookeeper#zookeeper;3.4.5 [not transitive]
[ivy:cachepath]         confs: [test]
[ivy:cachepath]         found junit#junit;4.8.1 in maven2
[ivy:cachepath]         found org.mockito#mockito-all;1.8.2 in maven2
[ivy:cachepath]         found checkstyle#checkstyle;5.0 in maven2
[ivy:cachepath] :: resolution report :: resolve 56ms :: artifacts dl 7ms
        ---------------------------------------------------------------------
        |                  |            modules            ||   artifacts   |
        |       conf       | number| search|dwnlded|evicted|| number|dwnlded|
        ---------------------------------------------------------------------
        |       test       |   3   |   0   |   0   |   0   ||   3   |   0   |
        ---------------------------------------------------------------------
  [eclipse] Writing the preferences for "org.eclipse.jdt.core".
  [eclipse] Writing the preferences for "org.eclipse.core.resources".
  [eclipse] Writing the project definition in the mode "java".
  [eclipse] Writing the classpath definition.

BUILD SUCCESSFUL
Total time: 1 minute 46 seconds
PS D:\development\ZK\zookeeper-3.4.5>

导入idea

在这里插入图片描述

在这里插入图片描述

接着下一步,下一步即可。

在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

当法律与事业相遇

你的鼓励是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值