[[Building-BuildingCamelfromSource]]
= Building Camel from Source

Camel uses http://maven.apache.org/[Maven] as its build and management
tool. If you don't fancy using Maven you can use your IDE directly or
Download a distribution or JAR.

[[Building-Prequisites]]
== Prequisites

*Required:*

* Java
** 1.8 or 1.11

* https://github.com/takari/maven-wrapper[Maven Wrapper] is used and bundled.

* Otherwise, http://maven.apache.org/download.html[download and install Maven]
** Maven 3.6.x or newer is required to build Camel 3 onwards

* Get the latest source from https://github.com/apache/camel/[Github]

[[Building-Mavenoptions]]
== Maven options

To build camel maven has to be configured to use more memory

[[Building-UnixLinuxMac]]
Unix/Linux/Mac

[source,text]
------------------------------------------------------------
export MAVEN_OPTS="-Xms2048m -Xmx3584m"
------------------------------------------------------------


[[Building-Windows]]
Windows

[source,text]
-------------------------------------------------------
set MAVEN_OPTS="-Xms2048m -Xmx3584m"
-------------------------------------------------------

[[Building-Anormalbuild]]
== A normal build

Beware this runs all the unit tests which takes a couple of hours.

[source,text]
-----------------
mvn clean install
-----------------

[[Building-Anormalbuildwithoutrunningtests]]
== A quick build without running tests

The following skips building the manual, the distro and does not execute
the unit tests, which can complete in 15-20 minutes.

[source,text]
-------------------------------
mvn clean install -Pfastinstall
-------------------------------

[[Building-Anormalbuildwithoutrunningtestsbutcheckstyleverificationenabled]]
== A normal build without running tests but checkstyle verification enabled

[source,text]
-------------------------------------------
mvn clean install -Pfastinstall,sourcecheck
-------------------------------------------

[[Building-Buildingwithcheckstyle]]
== Building with checkstyle

To enable source style checking with checkstyle, build Camel with the
-Psourcecheck parameter

[source,text]
-------------------------------
mvn clean install -Psourcecheck 
-------------------------------

[[Building-Buildingsourcejars]]
== Building source jars

If you want to build jar files with the source code, that for instance
Eclipse can important so you can debug the Camel code as well. Then you
can run this command from the camel root folder:

[source,text]
------------------------------------------
mvn clean source:jar install -Pfastinstall
------------------------------------------

[[Building-Workingwithkaraffeatures]]
== Working with karaf features

If you change anything in the features.xml from `platform/karaf` you can
run a validation step to ensure the generated features.xml file is
correct. You can do this running the following maven goal from the
`platform` directory.

[source,text]
----------------------------
mvn clean install -Pvalidate
----------------------------

