Developing Cassandra in eclipse

Source: Internet
Author: User
Tags cassandra

In the previousArticleIn, we explain how Cassandra is installed in configuration: how to install and configure cassandra

In this article, we will download Cassandra'sSource codeTo complete compilation and execute the corresponding unit test.

Configure the environment

1. Install JDK 6 and ant.

2. Install eclipse3.5

3 install http://subclipse.tigris.org/update_1.6.x in eclipse

Choose Help> install new software from the eclipse menu.

Next, you can install subclipse: Add-> enter the name and address http://subclipse.tigris.org/update_1.6.x-> select all the options you want to install

Click Next. Finally, restart eclipse after subclipse is installed.

Download Cassandra source code

Create a new SVN project in eclipse

Select: Create a new resource library location

Get SVN: https://svn.apache.org/repos/asf/cassandra/tags/cassandra-0.6.2/

Select as follows

Create a Java project as prompted. After checking out SVN, we can see the project we just created.

In this way, Cassandra's sourceCodeThe download is complete.

Compile cassandra

Assume that the source code of Cassandra we downloaded is located at D: \ workspace \ Cassandra-0.6.2. Then we use the command line tool to compile ant in this directory.

If the compilation is successful, the prompt is as follows:

We can see that the Java source files of thrift, Avro, and anlr are also generated during compilation.

Edit Cassandra source code in eclipse

Although the source code can be edited successfully, we still cannot use Cassandra to easily modify the source code.

Next, you need to configure eclipse step by step so that it can easily edit the Cassandra source code.

First, add all jar packages under the D: \ workspace \ Cassandra-0.6.2 \ lib directory to the build path of the project.

Then, edit the properties of the src directory. The default setting is

Delete the default directory and add the following src directory

The directory structure is as follows:

According to the normal process, even if we have completed the eclipse configuration, we can easily edit the Cassandra source code in eclipse.

However, there are still some minor bugs in eclipse that may affect normal functions, such as the situation I encountered.

As you can see, garbagecollectormxbean is actually a class in JDK, but the eclipse prompt cannot find the definition. The solution is as follows:

Open the build path of the project, and first remove the JRE system library.

Then, remove the JRE system library and add it back.

Finally, refresh the entire project and solve the error prompt.

Run unit test

We can also add the unit test code to eclipse.

The steps are very simple:

1. Add the jar package of junit4

2. Add the test code under the test directory to SRC.

The list of items after successful addition is as follows:

We can directly run an existing unit test in test.

Package and release

After modifying the Cassandra source code, we can package and release the modified version.

Use the ant command line: ant release

After the execution, we can see the packaged file in the D: \ workspace \ Cassandra-0.6.2 \ build directory.

In this way, we can use the modified Cassandra.

 

more about Cassandra: http://www.cnblogs.com/gpcuster/tag/Cassandra/

Related Article

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.