= Building

We use Apache Maven to build the code, distribution, etc. and to manage dependencies.

The minimum required Maven version is 3.0.0.

Note that there are some https://cwiki.apache.org/confluence/display/MAVEN/Maven+3.x+Compatibility+Notes[compatibility issues with Maven 3.X] still unsolved.
This is specially true for the https://maven.apache.org/plugins-archives/maven-site-plugin-3.3/maven-3.html['site' plugin].

== Full Release

To build the full release with the documentation & JavaDocs:
[,console]
----
$ mvn -Prelease package
----
To install it to your local maven repo:
[,console]
----
$ mvn -Prelease install
----
For any build you can skip the tests using `-DskipTests` which will make the build *much* faster, e.g.
[,console]
----
$ mvn -Prelease package -DskipTests
----

== Full Release without docs

It is possible to build a distribution without the manuals and Javadocs.
simply run
[,console]
----
$ mvn package
----

== Only docs

From the `artemis-website` module run:
[,console]
----
$ mvn -Prelease package
----
This will build the user manual (both HTML & PDF), migration guide, hacking guide, & JavaDocs.
Output will be placed in the `target/classes/user-manual`, `target/classes/migration-guide`, `target/classes/hacking-guide`, and `target/apidocs` directories respectively.

Generating the user manual's PDF adds almost a minute to the build so this can be skipped using `-DskipWebsitePdfGeneration`.

== Offline

Maven dependency:go-offline can be used to download various things the build needs. This necessitates some properties the build doesnt normally need set, so to make this work a helper profile called `go-offline` exists to have the os-maven-plugin set these properties based on the current environment. To run these together, do:
[,console]
----
$ mvn dependency:go-offline -Pgo-offline
$ mvn -o ...
----

Alternatively you can simply specify the needed properties directly, based on your environment preference. For example, on a Linux x86-64 environment you could run:
[,console]
----
$ mvn dependency:go-offline -Dos.detected.name=linux -Dos.detected.arch=x86_64 -Dos.detected.classifier=linux-x86_64
$ mvn -o ...
----

== Building the ASYNC IO library

ActiveMQ Artemis provides the `ASYNCIO` `journal-type` which interacts with the Linux kernel libaio library. The ASYNCIO journal type should be used where possible as it is far superior in terms of performance.

ActiveMQ Artemis does not ship with the Artemis Native ASYNCIO library in the _source_ distribution. This need to be built prior to running `mvn install`, to ensure that the ASYNCIO journal type is available in the resulting build. Don't worry if you don't want to use ASYNCIO or your system does not support libaio, ActiveMQ Artemis will check at runtime to see if the required libraries and system dependencies are available, if not it will default to using NIO.

To build the ActiveMQ Artemis ASYNCIO native libraries, please follow link:https://github.com/apache/activemq-artemis-native[these instructions].

== Open Web Application Security Project (OWASP) Report

If you wish to generate a report for dependency CVEs you may build with the `-Powasp` profile, e.g.:

[,console]
----
$ mvn -Powasp verify -DskipTests
----
The output will be under `./target/dependency-check-report.html` for *each* sub-module.