Apache Maven

See Maven – Welcome to Apache Maven

User's settings.xml and repository is in %USERPROFILE%\.m2\

Navigate to working directory
mvn archetype:generate -DarchetypeArtifactId=maven-archetype-quickstart
mvn archetype:generate -Dfilter=spring - this will search all artifacts for the word "spring"
groupId is the organisation: com.my company
artifactId – myapp (no spaces!)
package is the java package!
Eclipse import
Each artefact has a pom.xml, jar, war or ear
mvn help:effective-pom
mvn package - the default build it one


The easy way to install on a Mac is to make sure you have Java installed first and then do this:
brew install maven

Once installed doing mvn -v will show you how it is setup, so where Maven is actually installed and which Java it is using, this can be handy in diagnosing issues.


Maven Model – Maven - pom.xml reference documentation


It is good to stick to the standard plug-ins, see Maven – Available Plugins for a list of them. It is not that using others is bad but where possible it is better to stick to core stuff.

Try and use a bom, which is just a pom.xml with version dependencies in. This keeps all your versions in one place and should make things easier.

When making jar files use Apache Maven JAR Plugin – Introduction to add custom information to the manifest file. The good news is that this also works with maven-ear-plugin, maven-ejb-plugin and maven-war-plugin.

Finding Libraries

The best place to start is Maven Repository: Search/Browse/Explore which will help you find the latest or available version. Some useful ones I have used are:

Calling Ant

If you need to call Ant or run some basic Ant script then take a look at Apache Maven AntRun Plugin – Introduction for how to do it. Sure, it is not ideal but sometimes needs must.