Building with Maven

We use Apache Maven to make building, extending, and using ALIA4J as easy as possible. You can run Maven straight from the command line or rely on the excellent Maven Integration with the Eclipse IDE. This article describes how to set up Maven for command-line use only; a companion article describes how to set up and develop ALIA4J within the Eclipse IDE.

If not already installed Maven on your system, we recommend that you download the latest release of Maven 3. (We have used version 3.0.4 for this walkthrough.)

Once you have installed Maven, you have two choices: Either build the ALIA4J projects from source or simply use the artifacts deployed to our projects repository.

Building the ALIA4J Projects from Source

Once you have set up Maven and checked out all ALIA4J subprojects from our source repository you are ready for the initial build of ALIA4J. To kick off the Maven build, change into the alia4j directory.

The alia4j project is an aggregator project; it does not contain code itself, but rather points to other ALIA4J subprojects. In Maven lingo, these subprojects are known as modules. Executing a Maven lifecycle phase, e.g., install or clean, on an aggregator project will recursively execute the same phase on the project's modules as well. To build and install all ALIA4J subprojects into your local repository it is thus sufficient to issue the following command:

mvn clean install

Maven will now determine the reactor build order, i.e., the order in which the subprojects need to be build so that inter-project dependencies are honoured. Along the way Maven will download all external dependencies required by the various ALIA4J subprojects. Furthermore, it will not only build these subprojects, but also subject them to unit and integration tests, as the respective phase, test and integration-test precede install in the default lifecycle.

Most of the time, it is not necessary to build all subprojects of ALIA4J at once. We thus uses aggregators; for example, alia4j-noirin aggregates all the constituent subprojects of NOIRIn. After the initial build, which has installed all subprojects into your local Maven repository, you most likely need to rebuild no more than a handful of subprojects whenever you modify ALIA4J: In case you made changes to a single project only, simply change into that project's directory and execute the install lifecycle phase. In case you changed several related subprojects, e.g., those specific to the NOIRIn, execute the lifecycle phase in their common aggregator.

Using Already Deployed Artifacts

Instead of building the ALIA4J projects from source, you can simply point Maven to our repositories, provided that you do not need to modify the source code of ALIA4J itself. Just add the following to your settings.xml:

          <name>ALIA4J Release Repository</name>
          <name>ALIA4J Snapshots Repository</name>

Maven will now download both releases and development snapshots automatically whenever you declare a dependency to one of our artifacts in your POM. You can also choose to include just the repository containing releases or just the repository containing snapshots. For further documentation about using Maven repositories, please refer to this introduction.