1:配置ant环境

  1. https://archive.apache.org/dist/ant/binaries/  官网下载文件  1.10.0以上需要JDK1.8以上
  2. 否则会报
    Exception in thread "main" java.lang.UnsupportedClassVersionError: org/apache/tools/ant/launch/Launcher : Unsupported major.minor version 52.0
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
    at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)
  3. 查看本地环境JDK版本  java -version
    查看本机JDK环境
    ~ $java -version
    java version "1.7.0_79"
    Java(TM) SE Runtime Environment (build 1.7.0_79-b15)
    Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode)
    ~ $
  4. 本机下载的版本1.9.4,下载完之后,本地解压
  5. 环境变量配置
    第一步:
    ~ $vim .bash_profile 第二步:
    //配置文件中增加ant的文件路径
    export ANT_HOME=/Users/quruirui/ruirui.qu/Install/q/ant/apache-ant-1.9.4
    export PATH=${PATH}:${ANT_HOME}/bin
    //保存退出 第三步:
    ~ $source .bash_profile
  6. ~ $ant -version
    Apache Ant(TM) version 1.9.4 compiled on March 5 2013

    安装完毕

2.编译zk

1) 下载源码:https://github.com/apache/zookeeper

2) git  clone  https://github.com/apache/zookeeper.git

3)  进入源目录  执行ant eclipse

网上看帖子,别人都比较顺利,但是我这边问题比较多,列举如下解决方法

1.

zookeeper $ant eclipse
Buildfile: /Users/quruirui/ruirui.qu/pay/pay_learn/zookeeper/build.xml ant-eclipse-download:
[get] Getting: https://downloads.sourceforge.net/project/ant-eclipse/ant-eclipse/1.0/ant-eclipse-1.0.bin.tar.bz2
[get] To: /Users/quruirui/ruirui.qu/pay/pay_learn/zookeeper/src/java/ant-eclipse-1.0.bin.tar.bz2
[get] Error getting https://downloads.sourceforge.net/project/ant-eclipse/ant-eclipse/1.0/ant-eclipse-1.0.bin.tar.bz2 to /Users/quruirui/ruirui.qu/pay/pay_learn/zookeeper/src/java/ant-eclipse-1.0.bin.tar.bz2 BUILD FAILED
/Users/quruirui/ruirui.qu/pay/pay_learn/zookeeper/build.xml:1909: java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(SocketInputStream.java:196)
at java.net.SocketInputStream.read(SocketInputStream.java:122)
at sun.security.ssl.InputRecord.readFully(InputRecord.java:442)
at sun.security.ssl.InputRecord.read(InputRecord.java:480)
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:934)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1332)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1359)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1343)
at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:563)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:185)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.connect(HttpsURLConnectionImpl.java:153)
at org.apache.tools.ant.taskdefs.Get$GetThread.openConnection(Get.java:660)
at org.apache.tools.ant.taskdefs.Get$GetThread.get(Get.java:579)
at org.apache.tools.ant.taskdefs.Get$GetThread.run(Get.java:569)
=================》
//解决方法:将地址
get src="http://downloads.sourceforge.net/project/ant-eclipse/ant-eclipse/1.0/ant-eclipse-1.0.bin.tar.bz2" //替换为
<get src="http://ufpr.dl.sourceforge.net/project/ant-eclipse/ant-eclipse/1.0/ant-eclipse-1.0.bin.tar.bz2"
dest="${src.dir}/java/ant-eclipse-1.0.bin.tar.bz2" usetimestamp="false" />

2:

zookeeper $ant eclipse
Buildfile: /Users/quruirui/ruirui.qu/pay/pay_learn/zookeeper/build.xml ant-eclipse-download:
[get] Getting: https://downloads.sourceforge.net/project/ant-eclipse/ant-eclipse/1.0/ant-eclipse-1.0.bin.tar.bz2
[get] To: /Users/quruirui/ruirui.qu/pay/pay_learn/zookeeper/src/java/ant-eclipse-1.0.bin.tar.bz2
[get] Error getting https://downloads.sourceforge.net/project/ant-eclipse/ant-eclipse/1.0/ant-eclipse-1.0.bin.tar.bz2 to /Users/quruirui/ruirui.qu/pay/pay_learn/zookeeper/src/java/ant-eclipse-1.0.bin.tar.bz2 BUILD FAILED
/Users/quruirui/ruirui.qu/pay/pay_learn/zookeeper/build.xml:1909: java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(SocketInputStream.java:196)
at java.net.SocketInputStream.read(SocketInputStream.java:122)
at sun.security.ssl.InputRecord.readFully(InputRecord.java:442)
at sun.security.ssl.InputRecord.read(InputRecord.java:480)
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:934)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1332)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1359)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1343)
at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:563)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:185)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.connect(HttpsURLConnectionImpl.java:153)
at org.apache.tools.ant.taskdefs.Get$GetThread.openConnection(Get.java:712)
at org.apache.tools.ant.taskdefs.Get$GetThread.get(Get.java:626)
at org.apache.tools.ant.taskdefs.Get$GetThread.run(Get.java:616) zookeeper $ant eclipse
Buildfile: /Users/quruirui/ruirui.qu/pay/pay_learn/zookeeper/build.xml ant-eclipse-download:
[get] Getting: http://ufpr.dl.sourceforge.net/project/ant-eclipse/ant-eclipse/1.0/ant-eclipse-1.0.bin.tar.bz2
[get] To: /Users/quruirui/ruirui.qu/pay/pay_learn/zookeeper/src/java/ant-eclipse-1.0.bin.tar.bz2
[bunzip2] Expanding /Users/quruirui/ruirui.qu/pay/pay_learn/zookeeper/src/java/ant-eclipse-1.0.bin.tar.bz2 to /Users/quruirui/ruirui.qu/pay/pay_learn/zookeeper/src/java/ant-eclipse-1.0.bin.tar BUILD FAILED
/Users/quruirui/ruirui.qu/pay/pay_learn/zookeeper/build.xml:1911: Problem expanding bzip2 unexpected end of stream Total time: 1 minute 57 seconds //====>诡异 后来自己好了

3.

====>诡异  后来自己好了

zookeeper $ant  eclipse
Buildfile: /Users/quruirui/ruirui.qu/pay/pay_learn/zookeeper/build.xml ant-eclipse-download: init: ivy-download:
[get] Getting: https://repo1.maven.org/maven2/org/apache/ivy/ivy/2.4.0/ivy-2.4.0.jar
[get] To: /Users/quruirui/ruirui.qu/pay/pay_learn/zookeeper/src/java/lib/ivy-2.4.0.jar
[get] Error getting https://repo1.maven.org/maven2/org/apache/ivy/ivy/2.4.0/ivy-2.4.0.jar to /Users/quruirui/ruirui.qu/pay/pay_learn/zookeeper/src/java/lib/ivy-2.4.0.jar BUILD FAILED
/Users/quruirui/ruirui.qu/pay/pay_learn/zookeeper/build.xml:401: javax.net.ssl.SSLException: Received fatal alert: protocol_version
at sun.security.ssl.Alerts.getSSLException(Alerts.java:208)
at sun.security.ssl.Alerts.getSSLException(Alerts.java:154)
at sun.security.ssl.SSLSocketImpl.recvAlert(SSLSocketImpl.java:1979)
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1086)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1332)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1359)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1343)
at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:563)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:185)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.connect(HttpsURLConnectionImpl.java:153)
at org.apache.tools.ant.taskdefs.Get$GetThread.openConnection(Get.java:712)
at org.apache.tools.ant.taskdefs.Get$GetThread.get(Get.java:626)
at org.apache.tools.ant.taskdefs.Get$GetThread.run(Get.java:616)

[ivy:retrieve] :: commons-cli#commons-cli;1.2: not found
[ivy:retrieve] :: log4j#log4j;1.2.17: not found
[ivy:retrieve] :: org.apache.yetus#audience-annotations;0.5.0: not found
[ivy:retrieve] :: io.netty#netty;3.10.6.Final: not found
[ivy:retrieve] ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:retrieve] :::: ERRORS
[ivy:retrieve] Server access error at url https://repo1.maven.org/maven2/jline/jline/2.11/jline-2.11.pom (javax.net.ssl.SSLException: Received fatal alert: protocol_version)
[ivy:retrieve] Server access error at url https://repo1.maven.org/maven2/jline/jline/2.11/jline-2.11.jar (javax.net.ssl.SSLException: Received fatal alert: protocol_version)
[ivy:retrieve] Server access error at url https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-server/9.4.10.v20180503/jetty-server-9.4.10.v20180503.pom (javax.net.ssl.SSLException: Received fatal alert: protocol_version)
[ivy:retrieve] Server access error at url https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-server/9.4.10.v20180503/jetty-server-9.4.10.v20180503.jar (javax.net.ssl.SSLException: Received fatal alert: protocol_version)
[ivy:retrieve] Server access error at url https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-servlet/9.4.10.v20180503/jetty-servlet-9.4.10.v20180503.pom (javax.net.ssl.SSLException: Received fatal alert: protocol_version)
[ivy:retrieve] Server access error at url https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-servlet/9.4.10.v20180503/jetty-servlet-9.4.10.v20180503.jar (javax.net.ssl.SSLException: Received fatal alert: protocol_version)
[ivy:retrieve] Server access error at url https://repo1.maven.org/maven2/com/fasterxml/jackson/core/jackson-databind/2.9.5/jackson-databind-2.9.5.pom (javax.net.ssl.SSLException: Received fatal alert: protocol_version)
[ivy:retrieve] Server access error at url https://repo1.maven.org/maven2/com/fasterxml/jackson/core/jackson-databind/2.9.5/jackson-databind-2.9.5.jar (javax.net.ssl.SSLException: Received fatal alert: protocol_version)
[ivy:retrieve] Server access error at url https://repo1.maven.org/maven2/org/slf4j/slf4j-api/1.7.25/slf4j-api-1.7.25.pom (javax.net.ssl.SSLException: Received fatal alert: protocol_version)
[ivy:retrieve] Server access error at url https://repo1.maven.org/maven2/org/slf4j/slf4j-api/1.7.25/slf4j-api-1.7.25.jar (javax.net.ssl.SSLException: Received fatal alert: protocol_version)
[ivy:retrieve] Server access error at url https://repo1.maven.org/maven2/org/slf4j/slf4j-log4j12/1.7.25/slf4j-log4j12-1.7.25.pom (javax.net.ssl.SSLException: Received fatal alert: protocol_version)
[ivy:retrieve] Server access error at url https://repo1.maven.org/maven2/org/slf4j/slf4j-log4j12/1.7.25/slf4j-log4j12-1.7.25.jar (javax.net.ssl.SSLException: Received fatal alert: protocol_version)
[ivy:retrieve] Server access error at url https://repo1.maven.org/maven2/commons-cli/commons-cli/1.2/commons-cli-1.2.pom (javax.net.ssl.SSLException: Received fatal alert: protocol_version)
[ivy:retrieve] Server access error at url https://repo1.maven.org/maven2/commons-cli/commons-cli/1.2/commons-cli-1.2.jar (javax.net.ssl.SSLException: Received fatal alert: protocol_version)
[ivy:retrieve] Server access error at url https://repo1.maven.org/maven2/log4j/log4j/1.2.17/log4j-1.2.17.pom (javax.net.ssl.SSLException: Received fatal alert: protocol_version)
[ivy:retrieve] Server access error at url https://repo1.maven.org/maven2/log4j/log4j/1.2.17/log4j-1.2.17.jar (javax.net.ssl.SSLException: Received fatal alert: protocol_version)
[ivy:retrieve] Server access error at url https://repo1.maven.org/maven2/org/apache/yetus/audience-annotations/0.5.0/audience-annotations-0.5.0.pom (javax.net.ssl.SSLException: Received fatal alert: protocol_version)
[ivy:retrieve] Server access error at url https://repo1.maven.org/maven2/org/apache/yetus/audience-annotations/0.5.0/audience-annotations-0.5.0.jar (javax.net.ssl.SSLException: Received fatal alert: protocol_version)
[ivy:retrieve] Server access error at url https://repo1.maven.org/maven2/io/netty/netty/3.10.6.Final/netty-3.10.6.Final.pom (javax.net.ssl.SSLException: Received fatal alert: protocol_version)
[ivy:retrieve] Server access error at url https://repo1.maven.org/maven2/io/netty/netty/3.10.6.Final/netty-3.10.6.Final.jar (javax.net.ssl.SSLException: Received fatal alert: protocol_version)
[ivy:retrieve]
[ivy:retrieve] :: USE VERBOSE OR DEBUG MESSAGE LEVEL FOR MORE DETAILS


BUILD FAILED
/Users/quruirui/ruirui.qu/pay/pay_learn/zookeeper/build.xml:417: impossible to resolve dependencies:
resolve failed - see output for details

//======不知道是不是因为公司内网的原因,以上两种错误都是将ivy.xml   ivysettings.xml中所有的https  替换为http  搞定

4.

[ivy:retrieve] :: resolving dependencies :: org.apache.zookeeper#zookeeper;3.6.0-SNAPSHOT
[ivy:retrieve] confs: [javacc]
[ivy:retrieve] found net.java.dev.javacc#javacc;5.0 in maven2
[ivy:retrieve] :: resolution report :: resolve 35ms :: artifacts dl 1ms
---------------------------------------------------------------------
| | modules || artifacts |
| conf | number| search|dwnlded|evicted|| number|dwnlded|
---------------------------------------------------------------------
| javacc | 1 | 0 | 0 | 0 || 1 | 0 |
---------------------------------------------------------------------
[ivy:retrieve] :: retrieving :: org.apache.zookeeper#zookeeper
[ivy:retrieve] confs: [javacc]
[ivy:retrieve] 1 artifacts copied, 0 already retrieved (291kB/7ms) generate_jute_parser:
[ivy:artifactproperty] DEPRECATED: 'ivy.conf.file' is deprecated, use 'ivy.settings.file' instead
[ivy:artifactproperty] :: loading settings :: file = /Users/quruirui/ruirui.qu/pay/pay_learn/zookeeper/ivysettings.xml
[move] Moving 1 file to /Users/quruirui/ruirui.qu/pay/pay_learn/zookeeper/build/javacc/lib jute:
[javac] Compiling 39 source files to /Users/quruirui/ruirui.qu/pay/pay_learn/zookeeper/build/classes
[javac] javac: 无效的目标发行版: 1.8
[javac] 用法: javac <options> <source files>
[javac] -help 用于列出可能的选项 BUILD FAILED
/Users/quruirui/ruirui.qu/pay/pay_learn/zookeeper/build.xml:321: Compile failed; see the compiler error output for details. Total time: 1 second
//=======这个是因为本地的JDK版本不一致导致的,因为我本机装的是JDK1.7 两种方法:将本地的1.7升级为1.8;或者将build.xml中的如下两个值改为你本机配置的JDK版本
<property name="javac.target" value="1.7" />
<property name="javac.source" value="1.7" />

5.再次执行ant eclipse

[ivy:cachepath]     found org.hamcrest#hamcrest-all;1.3 in maven2
[ivy:cachepath] :: resolution report :: resolve 38493ms :: artifacts dl 18ms
---------------------------------------------------------------------
| | modules || artifacts |
| conf | number| search|dwnlded|evicted|| number|dwnlded|
---------------------------------------------------------------------
| test | 49 | 1 | 0 | 0 || 49 | 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

6.IDEA 安装lombok插件 设置Enable Annotation Processing后编译依然报错 解决方法;idea===》plugins===>安装lombok插件

7.zk源码导入idea  刚开始idea不能自动识别哪些是java文件,需要手动Mark directory as......  这点不是很智能

8.导入完成后,可能会有写依赖没载入,这时可以用project-structure-->module--->dependency  加入即可

MAC OS===>IntelliJ IDEA__ant__zookeeper源码编译的更多相关文章

  1. Mac openssl 和curl源码编译

    1.先编译openssl, 下载源码后解压,终端进入源码目录,输入命令配置编译环境:./Configure darwin64-x86_64-cc 等待配置完成后,输入make  和make insta ...

  2. 记一次在mac上源码编译curl,使其支持NSS的过程

    一.背景 在一次学习https原理的过程中,希望客户端指定特定的cipher suites来抓包分析SSL/TLS的握手过程,就想到了使用curl工具,而不是使用浏览器. 接下来使用man curl找 ...

  3. mpusher 源码编译 for windows X64

    mpusher 源码编译 for windows X64 对于java我是小白,通过一步步的摸索,将经验总结下来,给更多码友提供入门的帮助.一个人的摸索是很困难的,本教程感谢 [MPush开源消息推送 ...

  4. 从源码(编译)安装golang

    从源码安装golang 通常情况下,安装go只需要在官网(https://golang.org/dl/)下载适合系统的二进制发布包,按照安装说明进行安装即可. 对于Linux, Mac OS X和Fr ...

  5. 【流媒体开发】VLC Media Player - Android 平台源码编译 与 二次开发详解 (提供详细800M下载好的编译源码及eclipse可调试播放器源码下载)

    作者 : 韩曙亮  博客地址 : http://blog.csdn.net/shulianghan/article/details/42707293 转载请注明出处 : http://blog.csd ...

  6. Go源码编译安装

    参考文档1:https://www.cnblogs.com/majianguo/p/7258975.html 参考文档2:http://www.loongson.cn/news/company/456 ...

  7. 1.EOS源码编译运行

    目前网络上都是针对老版EOS2.0源码编译的文章,我在mac上参考这些文章编译,最后发现根本就不对,最新版本只需一条命令(./eosio_build.sh,依赖库会自动安装的)即可.我根据这些文章手动 ...

  8. 源码编译Redis Desktop Manager ---(转载)

    精美文章转载: 版权声明:本文作者为「Kany.Wang」,本博客所有文章除特别声明外,均采用 CC BY-NC-SA 3.0 许可协议.转载请注明出处!原文链接:https://kany.me/20 ...

  9. Android_7.1.1_r6源码编译

    上篇文章讲述了如何下载Android源码,在篇文章就来说一说Android源码编译.其实一般来说如果修改的软件和底层没什么关系,直接提取相应的源代码到Android Studio编译就可以了,如果是与 ...

随机推荐

  1. windows server2008 r2安装DNS服务器

    1.开始->管理工具->服务器管理器 2.角色->添加角色 3.服务器角色->DNS服务器 4.一直点击下一步,直至安装完成. (确认步骤时会提示,可能会需要重启服务器) 安装 ...

  2. C# combobox手动赋值

    DataTable dt = new DataTable(); dt.Columns.Add("REPAIR_VALUE"); dt.Columns.Add("REPAI ...

  3. Tomcat安装与使用

    主要讲解Tomcat的 安装与使用,讲解ubuntu版本和windows. 下载与安装: 1)到apache官网.www.apache.org http://jakarta.apache.org(产品 ...

  4. 【转】【C++专题】C++ sizeof 使用规则及陷阱分析

    提示:下文例子都经过Visual C++ 6.0验证,平台为win32 Windows. 一.什么是sizeof 首先看一下sizeof在msdn上的定义: The sizeof keyword gi ...

  5. C#-★★函数★★

    一个较大的程序一般应分为若干个程序块,每一个模块用来实现一个特定的功能.所有的高级语言中都有子程序这个概念,用子程序来实现模块的功能.在C#语言中,子程序的作用是由一个主函数和若干个函数构成.由主函数 ...

  6. P01-Python中列表的复制问题

    (1)使用=直接赋值 a = [1, 2, 3, [6, 7]] b = a 初始情况: a: [1, 2, 3, [6, 7]] b: [1, 2, 3, [6, 7]] ------------- ...

  7. 关于锚点定位,ul设置fixed后,div被覆盖一部分的问题

    例如: 问题: 刚开始的时候 .ul是正常显示的,当页面的滚动条滚动到一定的高度是 ,ul就被设置为 position:fixed:那么 点击 li相对应div就会被 固定定位的ul覆盖住一部分. 解 ...

  8. J15W-J45W黄铜截止阀厂家,J15W-J45W黄铜截止阀价格 - 专题栏目 - 无极资讯网

    无极资讯网 首页 最新资讯 最新图集 最新标签   搜索 J15W-J45W黄铜截止阀 无极资讯网精心为您挑选了(J15W-J45W黄铜截止阀)信息,其中包含了(J15W-J45W黄铜截止阀)厂家,( ...

  9. Restful API学习笔记

    之前关于这个概念在网上看了一些,看完似懂非懂,模模糊糊,发现专业术语或者说书面表达的形式对于理解这种十分抽象的概念还是低效了点. 书面文档方面看了以下几个: 理解本真的REST架构风格 1. 要深入理 ...

  10. leetcode有意思的题目总结

    231. 2的幂 2^3=8 得  8是2的幂 判断一个整数是不是2的幂,可根据二进制来分析.2的幂如2,4,8,等有一个特点: 二进制数首位为1,其他位为0,如2为10,4为100 2&(2 ...