MAC OS===>IntelliJ IDEA__ant__zookeeper源码编译
1:配置ant环境
- https://archive.apache.org/dist/ant/binaries/ 官网下载文件 1.10.0以上需要JDK1.8以上
- 否则会报
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) - 查看本地环境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)
~ $ - 本机下载的版本1.9.4,下载完之后,本地解压
- 环境变量配置
第一步:
~ $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 ~ $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源码编译的更多相关文章
- Mac openssl 和curl源码编译
1.先编译openssl, 下载源码后解压,终端进入源码目录,输入命令配置编译环境:./Configure darwin64-x86_64-cc 等待配置完成后,输入make 和make insta ...
- 记一次在mac上源码编译curl,使其支持NSS的过程
一.背景 在一次学习https原理的过程中,希望客户端指定特定的cipher suites来抓包分析SSL/TLS的握手过程,就想到了使用curl工具,而不是使用浏览器. 接下来使用man curl找 ...
- mpusher 源码编译 for windows X64
mpusher 源码编译 for windows X64 对于java我是小白,通过一步步的摸索,将经验总结下来,给更多码友提供入门的帮助.一个人的摸索是很困难的,本教程感谢 [MPush开源消息推送 ...
- 从源码(编译)安装golang
从源码安装golang 通常情况下,安装go只需要在官网(https://golang.org/dl/)下载适合系统的二进制发布包,按照安装说明进行安装即可. 对于Linux, Mac OS X和Fr ...
- 【流媒体开发】VLC Media Player - Android 平台源码编译 与 二次开发详解 (提供详细800M下载好的编译源码及eclipse可调试播放器源码下载)
作者 : 韩曙亮 博客地址 : http://blog.csdn.net/shulianghan/article/details/42707293 转载请注明出处 : http://blog.csd ...
- Go源码编译安装
参考文档1:https://www.cnblogs.com/majianguo/p/7258975.html 参考文档2:http://www.loongson.cn/news/company/456 ...
- 1.EOS源码编译运行
目前网络上都是针对老版EOS2.0源码编译的文章,我在mac上参考这些文章编译,最后发现根本就不对,最新版本只需一条命令(./eosio_build.sh,依赖库会自动安装的)即可.我根据这些文章手动 ...
- 源码编译Redis Desktop Manager ---(转载)
精美文章转载: 版权声明:本文作者为「Kany.Wang」,本博客所有文章除特别声明外,均采用 CC BY-NC-SA 3.0 许可协议.转载请注明出处!原文链接:https://kany.me/20 ...
- Android_7.1.1_r6源码编译
上篇文章讲述了如何下载Android源码,在篇文章就来说一说Android源码编译.其实一般来说如果修改的软件和底层没什么关系,直接提取相应的源代码到Android Studio编译就可以了,如果是与 ...
随机推荐
- RDLC报表的相关技巧四(报表内依照分组重置页码)
报表中不同的组重置页数,如采购订单每一个PO显示的页数都是针对这个PO的,而不是总的页数. 步骤: 1.在各组实例中启用分页符2.用高级模式将组的属性中的ResetPageNumber设置为True3 ...
- INSERT IGNORE 与INSERT INTO的区别,以及replace的用法
INSERT IGNORE 与INSERT INTO的区别就是INSERT IGNORE会忽略数据库中已经存在 的数据,如果数据库没有数据,就插入新的数据,如果有数据的话就跳过这条数据. 这样就可以保 ...
- 针对myeclipse6.5无法自动生成toString方法
public void getToStringSTR(){ Field[] fs = this.getClass().getDeclaredFields(); for (int i = 0; i &l ...
- openstack的部署与运维
来公司几个月了,除了搭建了kvm虚拟机,使用3台虚拟机组合成一个openstack的网络环境.还没有正式将openstack搭建起来过.时间都在开发web程序.不过openstack也是要学习的.只能 ...
- 机器学习中的范数规则化之 L0、L1与L2范数、核范数与规则项参数选择
装载自:https://blog.csdn.net/u012467880/article/details/52852242 今天我们聊聊机器学习中出现的非常频繁的问题:过拟合与规则化.我们先简单的来理 ...
- Linux环境部署安装Maven
第一步:Maven下载 1. 手动下载 访问官网:http://maven.apache.org/download.cgi 当前最新版本是3.6.0,如果想下载其他版本 可通过点击下图选中项进入历史更 ...
- 1016 部分A+B (15 分)
// 题目不难,感觉变量定义的有点儿多了#include <iostream> #include <cmath> using namespace std; int main() ...
- php尝试调用一个图灵机器人
1.需要到图灵机器人的网址,去注册一下账号.网址:http://www.tuling123.com/sso-web/index.html?ReturnURL=http%3A%2F%2Fwww.tuli ...
- 设置第三方的SMTP服务
取得授权码:
- PIE SDK与GeoServer结合说明文档
1. GeoServer简介 GeoServer是OpenGIS Web服务器规范的J2EE实现的社区开源项目,利用GeoServer可以方便的发布地图数据,允许用户对特征数据进行更新.删除.插入操 ...