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. 洛谷P4705 玩游戏(生成函数+多项式运算)

    题面 传送门 题解 妈呀这辣鸡题目调了我整整三天--最后发现竟然是因为分治\(NTT\)之后的多项式长度不是\(2\)的幂导致把多项式的值存下来的时候发生了一些玄学错误--玄学到了我\(WA\)的点全 ...

  2. 一分钟了解 TCP/IP 模型

    原文讲的不是特别细,为了便于理解,我颠倒了顺序. 写在开始 我们需要知道协议到底是什么. 在网络上,一个协议对应于管理系统之间如何相互通信的规则. 然后我们需要知道什么是协议族. 一个协议族是一系列协 ...

  3. io--文件内容的复制

    public class CopyTextTest_2 {  private static final int BUFFER_SIZE = 1024;  public static void main ...

  4. Maven依赖的JAR包下载慢?赶紧看过来

    相信许多JAVA开发者在日常工作中时常会碰到这种情况,那就是编译Maven工程时,工程所依赖的jar包文件下载非常慢,甚至经常出现下载不成功的问题,今天,小编就给大家讲讲如何提升Maven依赖包的下载 ...

  5. 2016级算法第五次上机-A.Beihang Collegiate Pronunciation Contest 2017

    1065 Beihang Collegiate Pronunciation Contest 2017 思路 在字符串中不断做匹配 找到一个匹配就输出 时间复杂度\(O(n)\) ps.模式串是定长的, ...

  6. Windows下Anaconda安装 python + tensorflow CPU版

    下载安装Anaconda 首先下载Anaconda,可以从清华大学的镜像网站进行下载. 安装Anaconda,注意安装时不要将添加环境变量的选项取消掉. 安装完成之后,在安装目录下cmd,输入: co ...

  7. 适配器模式-如何把usb插到插座上

    前言 下面所写的内容不是实际的业务场景, 也可能不符合正常的生活习惯, 或者不满足一些人的口味 所写的内容包括之前的帖子,只是为了方便大家更好的记住这个设计模式,实际生活中要灵活应用 设计模式重思想, ...

  8. urllib和urllib3

    urllib库 urllib 是一个用来处理网络请求的python标准库,它包含4个模块. urllib.request---请求模块,用于发起网络请求 urllib.parse---解析模块,用于解 ...

  9. watch深度监测

    假设有如下代码: <div> <p>FullName: {{fullName}}</p> <p>FirstName: <input type=&q ...

  10. [转] Jenkins pipeline 中获取 exit code, stdout and stderr 返回值和输出

    [From] https://issues.jenkins-ci.org/browse/JENKINS-44930 其做法是,把stdout定向到一个文件,sh 配置 returnStatus: tr ...