Building and IDE Integration

Building From Source

Getting started with Cassandra and IntelliJ IDEA or Eclipse is simple, once you manage to build Cassandra from source using Java 8, Git and Ant.

The source code for Cassandra is shared through the central Apache Git repository and organized by different branches. You can access the code for the current development branch through git as follows:

git clone cassandra-trunk

Other branches will point to different versions of Cassandra. Switching to a different branch requires checking out the branch by its name:

git checkout cassandra-3.0

You can get a list of available branches with git branch.

Finally build Cassandra using ant:


This may take a significant amount of time depending on whether artifacts have to be downloaded and the number of classes that need to be compiled.


You can setup multiple working trees for different Cassandra versions from the same repository using git-worktree.

Setting up Cassandra in IntelliJ IDEA

IntelliJ IDEA by JetBrains is one of the most popular IDEs for Cassandra and Java development in general. The Community Edition is provided as a free download with all features needed to get started developing Cassandra.

Setup Cassandra as a Project (C* 2.1 and newer)

Since 2.1.5, there is a new ant target: generate-idea-files. Please see our wiki for instructions for older Cassandra versions.

Please clone and build Cassandra as described above and execute the following steps:

  1. Once Cassandra is built, generate the IDEA files using ant:
ant generate-idea-files
  1. Start IDEA
  2. Open the IDEA project from the checked out Cassandra directory using the menu item Open in IDEA’s File menu

The project generated by the ant task generate-idea-files contains nearly everything you need to debug Cassandra and execute unit tests.

  • Run/debug defaults for JUnit
  • Run/debug configuration for Cassandra daemon
  • License header for Java source files
  • Cassandra code style
  • Inspections

Opening Cassandra in Apache NetBeans

Apache NetBeans is the elder of the open sourced java IDEs, and can be used for Cassandra development. There is no project setup or generation required to open Cassandra in NetBeans.

Open Cassandra as a Project (C* 4.0 and newer)

Please clone and build Cassandra as described above and execute the following steps:

  1. Start Apache NetBeans
  2. Open the NetBeans project from the ide/ folder of the checked out Cassandra directory using the menu item “Open Project…” in NetBeans’ File menu

The project opened supports building, running, debugging, and profiling Cassandra from within the IDE. These actions delegate to the ant build.xml script.

  • Build/Run/Debug Project is available via the Run/Debug menus, or the project context menu.
  • Profile Project is available via the Profile menu. In the opened Profiler tab, click the green “Profile” button.
  • Cassandra’s code style is honored in ide/nbproject/

The JAVA8_HOME system variable must be set in the environment that NetBeans starts in for the Run/Debug/Profile ant targets to execute.

Setting up Cassandra in Eclipse

Eclipse is a popular open source IDE that can be used for Cassandra development. Various Eclipse environments are available from the download page. The following guide was created with “Eclipse IDE for Java Developers”.

These instructions were tested on Ubuntu 16.04 with Eclipse Neon (4.6) using Cassandra 2.1, 2.2 and 3.x.

Project Settings

It is important that you generate the Eclipse files with Ant before trying to set up the Eclipse project.

  • Clone and build Cassandra as described above.
  • Run ant generate-eclipse-files to create the Eclipse settings.
  • Start Eclipse.
  • Select File->Import->Existing Projects into Workspace->Select git directory.
  • Make sure “cassandra-trunk” is recognized and selected as a project (assuming you checked the code out into the folder cassandra-trunk as described above).
  • Confirm “Finish” to have your project imported.

You should now be able to find the project as part of the “Package Explorer” or “Project Explorer” without having Eclipse complain about any errors after building the project automatically.

Unit Tests

Unit tests can be run from Eclipse by simply right-clicking the class file or method and selecting Run As->JUnit Test. Tests can be debugged this way as well by defining breakpoints (double-click line number) and selecting Debug As->JUnit Test.

Alternatively all unit tests can be run from the command line as described in Testing

Debugging Cassandra Using Eclipse

There are two ways how to start and debug a local Cassandra instance with Eclipse. You can either start Cassandra just as you normally would by using the ./bin/cassandra script and connect to the JVM through remotely from Eclipse or start Cassandra from Eclipse right away.

Starting Cassandra From Command Line

  • Set environment variable to define remote debugging options for the JVM: export JVM_EXTRA_OPTS="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=1414"
  • Start Cassandra by executing the ./bin/cassandra

Afterwards you should be able to connect to the running Cassandra process through the following steps:

From the menu, select Run->Debug Configurations..


Create new remote application


Configure connection settings by specifying a name and port 1414


Afterwards confirm “Debug” to connect to the JVM and start debugging Cassandra!

Starting Cassandra From Eclipse

Cassandra can also be started directly from Eclipse if you don’t want to use the command line.

From the menu, select Run->Run Configurations..


Create new application


Specify name, project and main class org.apache.cassandra.service.CassandraDaemon


Configure additional JVM specific parameters that will start Cassandra with some of the settings created by the regular startup script. Change heap related values as needed.

-Xms1024M -Xmx1024M -Xmn220M -Xss256k -ea -XX:+UseThreadPriorities -XX:ThreadPriorityPolicy=42 -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:+UseCondCardMark -javaagent:./lib/jamm-0.3.0.jar

Now just confirm “Debug” and you should see the output of Cassandra starting up in the Eclipse console and should be able to set breakpoints and start debugging!