Building

Apache Ratis uses Apache Maven to build the artifacts. It is required to have Maven 3.3.9 or later. Apache Ratis is written in Java 8. Therefore, it as well requires Java 8 or later.

Project could be built as a usual maven project:

$ mvn clean package -DskipTests

Note: subsequent builds could be faster with skiping shading/protobuf compile steps. See the next section for more info.

Shading

We shade protos, protobuf and other libraries such as Netty, gRPC, Guava and Hadoop so that applications using Ratis may use protobuf and other libraries with versions different from the versions used here.

Ratis requires the shaded sources for compilation. The generated sources are stored in the following directories.

ratis-proto-shaded/src/main/java/
ratis-hadoop-shaded/src/main/java/

They are not checked-in to git though.

By default protobuf compilation and shading are triggered at every build. To make more faster the additional builds, you can turn them off:

$ mvn package -DskipTests -DskipShade

During the clean lifecycle all the shaded classes are also deleted. You can clean the compiled files but keep the shaded classes with the following command:

$ mvn clean -DskipCleanShade

What are shaded?

Original packagesShaded packages
com.google.commonorg.apache.ratis.shaded.com.google.common
com.google.protobuforg.apache.ratis.shaded.com.google.protobuf
com.google.thirdparty.publicsuffixorg.apache.ratis.shaded.com.google.thirdparty.publicsuffix
io.grpcorg.apache.ratis.shaded.io.grpc
io.nettyorg.apache.ratis.shaded.io.netty
org.apache.hadoop.ipc.protobuforg.apache.ratis.shaded.org.apache.hadoop.ipc.protobuf

The protos defined in this project are stored in the org.apache.ratis.shaded.proto package.