zk 3.4.9版本号
1.首先你要会java,有过java eclipse编码经验.
2.安装java 和 ant ,然后命令行里能执行java 和 ant
3. 之前一直用maven,对ant不熟悉. 去入门了下ant
4. 执行ant bin-package
5. ant eclipse
6. 修改eclipse里的项目属性里的java编译级别,和build.xml一致即可.
7. 找到.classpath 研究下对应的路径. 新建一个log4j.xml放到到classPath中去. (见附件)
8. 想导到idea中的话,利用idea里的"导入 eclipse 项目"的功能.
遇到的问题
如果遇到无法执行 ivy 的. 需要下载ivy-2.4.0.jar放到ant/bin/lib中
1. 未与 -source 1.6 一起设置引导类路径
我本地是jdk 7故 修改build.xml为1.7
<property name="javac.target" value="1.7" /> <property name="javac.source" value="1.7" />
2. Execute failed: java.io.IOException: Cannot run program "autoreconf"
安装 autoconf . 我是mac 使用 brew 安装. brew install autoconf
3.Can't exec "aclocal": No such file or directory at /usr/local/Cellar/autoconf/2.69/share/autoconf/Autom4te/FileUtils.pm line 326.
安装automake 我是mac 使用 brew 安装. brew install automake
4. 国内下载pom非常慢. 增加了aliyun和ibiblio两个源
<ivysettings> <!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <property name="repo.aliyun.org" value="http://maven.aliyun.com/nexus/content/groups/public/" override="false"/> <property name="repo.ibiblio.org" value="http://mirrors.ibiblio.org/maven2/" override="false"/> <property name="repo.maven.org" value="http://repo1.maven.org/maven2/" override="false"/> <property name="repo.jboss.org" value="http://repository.jboss.org/nexus/content/groups/public/" override="false"/> <property name="repo.sun.org" value="http://download.java.net/maven/2/" override="false"/> <property name="maven2.pattern" value="[organisation]/[module]/[revision]/[module]-[revision]"/> <property name="maven2.pattern.ext" value="${maven2.pattern}.[ext]"/> <include url="${ivy.default.conf.dir}/ivyconf-local.xml"/> <settings defaultResolver="default"/> <resolvers> <ibiblio name="aliyun-maven2" root="${repo.aliyun.org}" pattern="${maven2.pattern.ext}" m2compatible="true"/> <ibiblio name="ibiblio-maven2" root="${repo.ibiblio.org}" pattern="${maven2.pattern.ext}" m2compatible="true"/> <ibiblio name="maven2" root="${repo.maven.org}" pattern="${maven2.pattern.ext}" m2compatible="true"/> <ibiblio name="jboss-maven2" root="${repo.jboss.org}" pattern="${maven2.pattern.ext}" m2compatible="true"/> <ibiblio name="sun-maven2" root="${repo.sun.org}" pattern="${maven2.pattern.ext}" m2compatible="true"/> <chain name="default" dual="true"> <resolver ref="aliyun-maven2"/> <resolver ref="ibiblio-maven2"/> <resolver ref="maven2"/> <resolver ref="jboss-maven2"/> <resolver ref="sun-maven2"/> </chain> </resolvers> </ivysettings> 5.配置eclipse的java编译级别未1.7 6. ant src/java/main/org/apache/zookeeper/ClientCnxn.java:786: error: cannot acccess WatchedEvent /Users/loufei/IdeaProjects/github/zookeeper/build.xml:396: Compile failed; see the compiler error output for details. 1. 代码回滚( 我是git ,故使用git add. ; git reset --hard HEAD ) 2. ant clean 然后重新执行 ant bin-package 7.
---------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER" />
<classpathentry kind="src" path="src/java/main" output=".eclipse/classes-main" />
<classpathentry kind="src" path="src/java/generated" output=".eclipse/classes-main" />
<classpathentry kind="src" path="src/java/test" output=".eclipse/classes-test" />
<classpathentry kind="src" path="src/java/systest" output=".eclipse/classes-test" />
<classpathentry kind="lib" path="/Users/loufei/.ant/cache/org.slf4j/slf4j-api/jars/slf4j-api-1.6.1.jar" exported="true" />
<classpathentry kind="lib" path="/Users/loufei/.ant/cache/org.slf4j/slf4j-log4j12/jars/slf4j-log4j12-1.6.1.jar" exported="true" />
<classpathentry kind="lib" path="/Users/loufei/.ant/cache/log4j/log4j/bundles/log4j-1.2.16.jar" exported="true" />
<classpathentry kind="lib" path="/Users/loufei/.ant/cache/jline/jline/jars/jline-0.9.94.jar" exported="true" />
<classpathentry kind="lib" path="/Users/loufei/.ant/cache/io.netty/netty/jars/netty-3.10.5.Final.jar" exported="true" />
<classpathentry kind="lib" path="/Users/loufei/.ant/cache/junit/junit/jars/junit-4.8.1.jar" />
<classpathentry kind="lib" path="/Users/loufei/.ant/cache/org.mockito/mockito-all/jars/mockito-all-1.8.2.jar" />
<classpathentry kind="lib" path="/Users/loufei/.ant/cache/checkstyle/checkstyle/jars/checkstyle-5.0.jar" />
<classpathentry kind="lib" path="/Users/loufei/.ant/cache/commons-collections/commons-collections/jars/commons-collections-3.2.2.jar" />
<classpathentry kind="output" path=".eclipse/classes-main" />
</classpath>