Building Camel from Source

Common Requirements

  • About 10Gb of free disk space for the compiled code and local Maven cache.

  • At least 3.5Gb of RAM.

  • A relatively modern operating system (Linux, Windows, macOS, *BSDs).

    • Other operating systems capable of running Java should work too, although that is not tested by the project

Prerequisites for Camel 3.x

  • Java 11 (we test using OpenJDK, but any modern JDK should be fine).

  • Apache Maven version 3.8.0 or greater to build the code. You can either use your own Maven package or build using the Maven Wrapper (mvnw) provided with the project.

Prerequisites for Camel 4.x

  • Java 17 (we test using OpenJDK, but any modern JDK should be fine).

  • Maven Wrapper can be used and is bundled.

  • Apache Maven version 3.9.0 or greater to build the code. You can either use your own Maven package or build using the Maven Wrapper (mvnw) provided with the project.

Maven

Running the Maven Wrapper mvnw script with -v parameter from the root directory of the project will reveal the recommended Maven version:

./mvnw -v
Apache Maven 1.2.3
Maven home: /home/user/.m2/wrapper/dists/apache-maven-1.2.3-bin/deadbeef/apache-maven-1.2.3
Java version: 17.0.5, vendor: Eclipse Adoptium, runtime: /home/user/java/17.0.5-tem
Default locale: en_IE, platform encoding: UTF-8
OS name: "linux", version: "6.3.7-200.fc38.x86_64", arch: "amd64", family: "unix"

If you do not like installing Maven manually, you can keep using mvnw instead of mvn.

Camel committers and experienced Camel contributors are may also use Maven Daemon mvnd to build Camel faster.

Maven options

To build Camel maven has to be configured to use more memory, which is done automatically via the .mvn/jvm.config file.

A normal build

Beware this runs all the unit tests which takes many hours.

mvn clean install

Building Camel 3

The following command will do a fast build.

mvn clean install -Pfastinstall

Building Camel 4

The following command will do a fast build.

mvn clean install -Dquickly

On Camel 4, you can also use -Pfastinstall to trigger a fast build, but we encourage contributors to switch to the new command.

On Camel 4, Virtual Threads can only be enabled by compiling with JDK 21 or greater and adding the system property -Dcamel.threads.virtual.enabled=true to your build command.

The commands above will build Camel in a quick way: skipping build optional artifacts and running tests. In most modern computers, this should complete in at most 30 minutes (usually much less, for newer hardware).

Building source jars

If you want to build jar files with the source code, then you can run this command from the camel root folder:

mvn -Pfastinstall,source-jar clean install

Building for deployment

If you want to build Camel so it can be deployed to a Maven repository, then you can run this command from the camel root folder:

mvn -Pfastinstall,deploy clean install

The build with deployment will build source jars, javadoc and other artifacts needed for deployment.

Verifying the coding style

Camel 4.x

Starting with Camel 4.0.0, our build system will automatically verify and format the code when doing a full build or when running certain phases that trigger it (i.e.; when running mvn verify).

Camel 3.x

Apache Camel source code uses a coding style/format that can be verified for compliance using the "checkstyle" plugin.

To enable source style checking, build Camel with the -Psourcecheck profile:

mvn clean install -Psourcecheck

Please remember to run this check on your code changes before submitting a patch or GitHub PR. You do not need to run this against the entire project, but only in the modules you modified.

For instance, if you do some code changes in the camel-ftp component, following which you can run the check from within this directory:

cd camel-ftp
mvn clean install -Psourcecheck