编程语言
首页 > 编程语言> > Zookeeper源码导入IDEA

Zookeeper源码导入IDEA

作者:互联网

记录一下Mac下使用IDEA导入zookeeper源码,全文参考了文末博文。

源码准备

github下载源码,地址为https://github.com/apache/zookeeper,选择对应的分支进行下载,这里选择的是3.4.14。

安装ant

官网(https://ant.apache.org/bindownload.cgi)下载ant,选择对应的版本。

配置环境变量,修改~/.bash_profile,添加ant的安装信息。

(base) [yangchaolin@youngchaolin-Mac.local ~/apache-ant-1.9.15/bin]$ vim ~/.bash_profile

添加ant的安装信息。

# ant的解压目录
export ANT_HOME=/Users/yangchaolin/apache-ant-1.9.15
# 添加环境变量
export PATH=$PATH:$ANT_HOME/bin

让新添加的信息生效。

(base) [yangchaolin@youngchaolin-Mac.local ~/apache-ant-1.9.15/bin]$ source ~/.bash_profile

使用ant -version命令查看,是否成功安装,如下所示即为成功安装。

(base) [yangchaolin@youngchaolin-Mac.local ~/apache-ant-1.9.15/bin]$ ant -version
Apache Ant(TM) version 1.9.15 compiled on May 10 2020

源码构建

进入zookeeper源码目录,使用ant eclipse命令,将项目编译并转化为eclipse的项目结构。

(base) [yangchaolin@youngchaolin-Mac.local ~/zookeeper-branch-3.4.14]$ ant eclipse
Buildfile: /Users/yangchaolin/zookeeper-branch-3.4.14/build.xml

编译过程比较长,大概几分钟左右。

(base) [yangchaolin@youngchaolin-Mac.local ~/zookeeper-branch-3.4.14]$ ant eclipse
Buildfile: /Users/yangchaolin/zookeeper-branch-3.4.14/build.xml

ant-eclipse-download:

init:

ivy-download:

ivy-taskdef:

ivy-init:

ivy-retrieve:
[ivy:retrieve] :: Apache Ivy 2.4.0 - 20141213170938 :: http://ant.apache.org/ivy/ ::
[ivy:retrieve] :: loading settings :: file = /Users/yangchaolin/zookeeper-branch-3.4.14/ivysettings.xml
[ivy:retrieve] :: resolving dependencies :: org.apache.zookeeper#zookeeper;3.4.14

# 过程略

	---------------------------------------------------------------------
	|                  |            modules            ||   artifacts   |
	|       conf       | number| search|dwnlded|evicted|| number|dwnlded|
	---------------------------------------------------------------------
	|       test       |   93  |   0   |   0   |   0   ||   93  |   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

IDEA导入

首先import导入。

选择eclipse导入方式。

完成导入。

以上,就是zookeeper源码导入IDEA的过程,后续就可以debug查看自己想看的业务代码线。

参考博文

(1)https://blog.csdn.net/moxiaomo0804/article/details/104249596

(2)https://www.cnblogs.com/heyonggang/p/12123991.html

标签:yangchaolin,zookeeper,Zookeeper,eclipse,IDEA,ant,源码,apache,ivy
来源: https://www.cnblogs.com/youngchaolin/p/12904014.html