Building a Project

The vast majority of Maven-built projects can be built with the following command:

mvn clean install

This command tells Maven to build all the modules, and to install it in the local repository. The local repository is created in your home directory (or alternative location that you created it), and is the location that all downloaded binaries and the projects you built are stored.

That’s it! If you look in the target subdirectory, you should find the build output and the final library or application that was being built.

Note: Some projects have multiple modules, so the library or application you are looking for may be in a module subdirectory.

While this will build most projects and Maven encourages this standard convention, builds can be customisable. If this does not suffice, please consult the project’s documentation.

More than just the Build

Maven can do more than just build software – it can assist with testing, run web applications and produce reports on projects, as well as any number of other tasks provided by plug-ins.

To try some other tasks, see the Cookbook for Running Maven.