IntroductionThis 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. Commons components now use version 3 of Maven, so this is the Maven version assumed throughout this document. Commons Parent POMCommons componenents share a common parent POM. This contains common setup to reduce the setup needed in each component POM and standardizes the builds across Commons components. Local environment setupTo build Apache Commons components or web sites, you need to have Maven installed and the project source files checked out locally. Getting and installing MavenFollow 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 Configuring local properties
If you regularly want to build Commons components using a different version of Java
than that used to run Maven, you may wish to define the locations of the alternate
JDKs in the Maven Maven CommandsCompile and test with a specific JDK
To compile and run a component's tests with JDK 1.5.
This assumes that the property JAVA_1_5_HOME has been defined in the Maven mvn clean test -Pjava-1.5 To compile (only) source and test files with Java 1.6 if settings.xml does not contain the property definitions (note this overrides any definition in settings.xml): mvn [clean] test-compile -Pjava-1.6 -DJAVA_1_6_HOME=path-to-jdk-home Running the TestsTo run a component's tests: mvn test Creating a jar fileTo create a component's jar: mvn package InstallingTo install a component in your local repository: mvn install Source and binary distributionsTo create the source and binary distributions for a component (and the javadoc and sources jars): mvn -Prelease package Generating the SiteTo generate a components site: mvn site |