= Building {brandname}
{brandname} uses link:http://maven.apache.org/[Maven] as a build system.

== Requirements
* Java {jdkminversion} or above
* Maven {mavenminversion} or above

WARNING: Make sure you follow the steps outlined in link:https://developer.jboss.org/docs/DOC-15169[Maven Getting Started - Users] to set up your JBoss repository correctly.
This step is _crucial_ to ensure your Maven setup can locate JBoss artifacts!
If you also want to test the EAP integration modules you should also add the appropriate link:http://maven.repository.redhat.com/[Enterprise Red Hat Maven Repository.]

== Maven
The following is an example `settings.xml` to get you started:

.settings.xml
[source,xml,options="nowrap",subs=attributes+]
----
include::../xml/settings.xml[]
----

=== Quick command reference

TIP: Maven places it's output in `target/`
[cols="2,1", options="header", width="80%"]
|===============
|Command|Meaning
| `mvn clean` |Cleans out any old builds and binaries
| `mvn compile` |Compiles java source code
| `mvn test` |Runs the TestNG unit test suite on the compiled code. Will also compile the tests. See the testing section below for more information on running different test groups. The default test group run is the "unit" group.
| `mvn package` | Packages the module as a JAR file, the resulting JAR file will be in target/
| `mvn package -DskipTests` |Creates a JAR file without running tests
| `mvn package -DskipTests -P minimal-distribution` |Creates a reduced version of the distribution with all modules,scripts...etc but no javadoc or source code. This is very handy to quickly build the distribution in order to run some tests.
| `mvn install -DskipTests` |Installs the artifacts in your local repo for use by other projects/modules, including inter-module dependencies within the same project.
| `mvn install -P distribution` | In addition to install, will also use Maven's assembly plugin to build ZIP files for distribution (in target/distribution ). Contents of various distribution are controlled by the files in src/main/resources/assemblies .
| `mvn deploy` |Builds and deploy the project to the JBoss snapshots repository.
| `mvn install -P-extras` |Avoids the extras profile disables the enforce plugin and generation of source jars, hence making builds run faster. Clearly, this option should not be used when making a release or publishing a snapshot.
|===============

=== Publishing releases to Maven

To be able to publish releases to Maven, you need to have the following in your `settings.xml` file:

.settings.xml
[source,xml,options="nowrap",subs=attributes+]
----
include::../xml/settings_credentials.xml[]
----

==== Publishing snapshots
Simply running

 $ mvn clean deploy -DskipTests

in the {brandname} root directory will deploy a snapshot.

==== Contributing tests back to {brandname}
If you have written a functional, unit or stress test for {brandname} and want to contribute this back to {brandname}, your best bet is to link:https://github.com/infinispan/infinispan[fork the {brandname} sources on GitHub].
The test you would have prototyped and tested in an isolated project created using this archetype can be simply dropped in to {brandname}'s test suite.
Make your changes, add your test, prove that it fails even on {brandname}'s upstream source tree and issue a link:http://help.github.com/pull-requests/[pull request] .

==== Checking coding style
If you have written any new code, it is highly recommended to validate formatting before submitting a Pull Request.
This might be done by invoking:

 $ mvn checkstyle:check
