Set Up Shardingsphere Development Environment

Set Up Shardingsphere Development Environment

This document used the official release version to set up and verify development environment. This way could help to rule out any unstable issues of source code and to focus the issues on environment.


  • Linux (Ubuntu 18.04)
  • Source code 4.1.1
  • Eclipse
  • IntelliJ IDEA
Choose the proper IDE (Eclipse or IntelliJ IDEA), even No IDE

Java Development Environment (No IDE)

Install JDK 8

sudo apt install openjdk-8-jdk

$ java -version
openjdk version "1.8.0_252"
OpenJDK Runtime Environment (build 1.8.0_252-8u252-b09-1~18.04-b09)
OpenJDK 64-Bit Server VM (build 25.252-b09, mixed mode)

Install Maven (Optional)

sudo apt install maven

$ mvn -version
Apache Maven 3.6.0
Maven home: /usr/share/maven
Java version: 1.8.0_252, vendor: Private Build, runtime: /usr/lib/jvm/java-8-openjdk-amd64/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "5.4.0-42-generic", arch: "amd64", family: "unix"

Unzip Source Code

  • Download Source Code

  • Unzip the source code

  • Change file permissions

      chmod -R 755 apache-shardingsphere-4.1.1-src-release/

Build and Test

Based the Github page Build Apache ShardingSphere, there is a script to do the build

./mvnw clean install -Prelease
Make sure all the tests pass

Issues and Tricks

  • Lombok in the project not support Java 11
    If Java 11 is set as default, this may cause the error below for Lombok does not support Java 11. java.lang.ExceptionInInitializerError

Use Java 8.

  • Multiple Java version installed
    If multiple versions of Java are installed on the system, such as Java 11 and Java 8, in the mean time, Java 11 is set as default, the above error will cause the build failure. Even the default JDK is changed to Java 8 by update-alternatives –config java, the above issue may still be there.

Uninstall all the JDKs by the command

sudo apt-get remove openjdk* 

and reinstall JDK 8.


Import the Project

Follow the steps below to import the project.

Import projects… or File —> Import… import-projects

The import is done by m2e plugin.
The warning shown below can be ignored.
maven-remote-resources-plugin (goal “process”) is ignored by m2e.

Build and Test

Build and test as separate steps, i.e.

  • Run As —> Maven clean
  • Run As —> Maven build
  • Run As —> Maven test
  • Run As —> Maven install


Or define the goals at one time, i.e. Run As —> Maven build… —> Goals: (clean install) maven-custom-build

Specific module can be chosen and do the same build.
Maven will build the dependencies automatically.

Issues and Tricks

  • Too many files with unapproved license
    When doing ‘install’, the below error occurs. No issue with ‘build’ and ‘test’, but with ‘install’

[INFO] BUILD FAILURE Too many files with unapproved license

Use or check out clean source code, then do ‘install’.

  • Build failed with 8 threads
    When setting 8 threads for build, the build failed.

Set build threads as 1.


IntelliJ IDEA

Import the Project

Follow the steps below to import the project.

On the Welcome window, select Import Project, then select the project POM file in the next window. intellij-idea-import

The errors and warnings of the POM file analysis can be ignored.

Build and Test

As there are errors in the POM file, the tool window of Maven lifecyle may not show up automatically.
To add Maven support, right click on the project name in the project view, then select Add Framework Support….

In the Maven window, different phase of lifecyle of project or module can be chosen to build.


Specific module can be chosen and do the build.
Maven will build the dependencies automatically.

Maven - Build Life Cycle
Introduction to the Build Lifecycle

Did you find this page helpful? Consider sharing it 🙌

Hongwei Li
Hongwei Li
Software, Networking

Always on the way - Coding, DevOps, Networking.