Apache Commons logo


This document provides information on setting up and executing builds for Apache Commons components and web sites. The contents include best practices and conventions that commons components should follow. This information should be useful to committers setting up new components as well as to volunteers who want to build commons components or web sites from source or to contribute patches to the build artifacts.

The assumption throughout is that we are working with a component named "Apache Commons Foo" that uses Maven as its build system, both for distribution binaries and for the web site.

Some knowledge of Maven is assumed in this document. Please refer to the Maven user guide for more information. Most commons components now use version 2 of Maven, so this is the Maven version assumed throughout this document. See here for Maven 1 details.

Local environment setup

To build Apache Commons components or web sites, you need to have Maven installed and the project source files checked out locally.

Getting and installing Maven

Follow the Maven download instructions to download and install Maven.

Checking out the commons sources

Follow the commons subversion instructions to check out the commons source files. If you want to build commons component web sites, you need to have the commons-build module checked out as a peer to whatever component(s) you are trying to generate the site for. If you check out the full set of "trunks" using the svn externals "trunks-proper" or "trunks-sandbox" this will happen automatically.

Configuring local properties

You only need to configure local properties if you want to build using different versions of Java. See here for more details.

Maven Commands

Running the Tests

To run a component's tests:

mvn test

Creating a jar file

To create a component's jar:

mvn package


To install a component in your local repository:

mvn install

Source and binary distributions

To create the source and binary distributions for a component (and the javadoc and sources jars):

mvn -Prc package

Generating the Site

To generate a components site:

mvn site