powered by text files


Notes on using Maven

I’ve been looking at build tools for JVM projects. These are the notes I took while reviewing Maven.

Refactoring Maven Projects

For a given Maven project, these are some strategies to optimise the process. Mostly this is the DRY principle - Don’t Repeat Yourself.

Build profiles

Use build profiles to setup different environments for dev/test/staging/production

Finding bundles

There is an online repository at

Maven Properties

Note: you can use maven properties in resource files, such as a .properties or .xml file under src/main/resources.

You need to enable this in the pom.xml:


Assigning custom properties per profile can help with deployment into multiple environments.

Maven & Eclipse

Eclipse has very good integration for Maven. Later versions of Eclipse include this in their package. It can also be added from

Maven Archetypes

Archetypes exist for a range of different project types.

mvn archetype:generate

Custom archetypes can be developed if you have a new type of project or generated from an existing project.

Maven sites

Maven can generate a site for your project showing information about the project and various reports.

mvn archetype:create -DgroupId=com.example -DartifactId=sample-project
cd sample-project
mvn site:run
mvn clean site
mvn site:run
mvn clean site-deploy

Repository Manager

Hosting a local repository for a team provides a number of benefits, including a local cache to avoid excessive network usage. Additionally, work can be shared both internally and externally.

A repository can be as simple as a file system with the appropriate layout, or a full repository manager. Nexus is an option for hosting a repository. It can be downloaded from:

Other Resources

Note: I’m continuing with lein for my clojure projects. To integrate with Maven, you can generate a pom.xml file for a with “lein pom.