Zookeeper source code compiled to Eclipseproject (Win7 ant compilation)

Source: Internet
Author: User

In order to learn zookeeper source code in depth, it is first thought to import it into the Eclispe, so first compile it to eclispeproject.


1. What is Ant???

Apache Ant?

Apache Ant is a Java library and command-line tool whose mission are to drive processes described in build files as targets and extension points dependent upon each other. The main known usage of ANT is the build of Java applications. Ant supplies a number of built-in tasks allowing to compile, assemble, test and run Java applications. Ant can also is used effectively to build non Java applications, for instance C or C + + applications. More generally, Ant can is used to pilot any type of process which can is described in terms of targets and tasks.

Ant is written in Java. Users of Ant can develop their own "antlibs" containing Ant tasks and types, and is offered a large number of ready-made Commercial or Open-source "Antlibs".

Ant is extremely flexible and does no impose coding conventions or directory layouts to the Java projects which adopt it As a build tool.

Software development projects looking for a solution combining build tool and dependency management can use ANT in Combina tion with Apache Ivy.

The Apache Ant Project is part of the Apache software Foundation.


Apache Ant is a tool that links software compilation, testing, deployment, and other steps to its own initiative, mostly for software development in the Java environment. Provided by the Apache Software Foundation.
Anyone who has ever used a Linux system should know to make this command. This command is often used when compiling the Linux kernel and some of the software's source programs. The make command is actually a project management tool. And Ant implements the same functionality. The compiler tools like Make,gnumake and NMAKE have some flaws, but ant overcomes the flaws of these tools. Initially, ant developers developed cross-platform applications in the same way that they were better designed for ant based on these flaws.

The core of ant is its build file, and when you start a new project, you should first write the ant build file.

The build file defines the build process and is used by everyone in the team development. The ant build file is named Build.xml by default. can also take other names. Simply pass this name as a reference to ant at the time of execution. The build file can be placed in whatever location. The general practice is to put it in the top-level folder of the project. This will keep the project concise and clear. The following is a typical project hierarchy.
(1) src deposit file.
(2) class holds the compiled file.
(3) Lib holds third-party jar packages.


(4) Dist Storage Packaging, published after the code.

Many other knowledge about ant can be searched on your own.


2. Install Ant

(1) Download ant, I downloaded the apache-ant-1.9.4-bin.zip (address: http://ant.apache.org/bindownload.cgi)

(2) Extract to a specific folder, set Ant_home (ANT's decompression path) and path (%ant_home%\bin)

(3) Open cmd. Execute ant-version. A version number message appears stating that the installation was successful.


3, download zookeeper source code and use ant to compile to Eclipseproject

Zookeeper GitHub is: https://github.com/apache/zookeeper

Unzip, open cmd. Switch to the root folder of the zookeeper source code below (there is a build.xml file below), then enter the command > Ant eclipse

The following interface prompts you to compile successfully:



Then open Eclispe, whatever the version number, select Import. The type is an existing eclispeproject.



Click Finish. But found that my source code actually has several errors. Just the types are the same, both are cannot switch on a value of type XXX:



On the web, you need to switch JDK 7 to JDK 6 with the JDK version number that the project file uses to compile:

Right-click on the imported Zookeeperproject-"properties-" Java Compiler, switch Compiler compliance level to 1.6:



This makes the error disappear, and the following will start the journey to the real zookeeper source code.


Zookeeper source code compiled to Eclipseproject (Win7 ant compilation)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.