Maven is a tool for the management and construction of software projects, especially for those based on Java. Maven has similar goals to *make* and *ant*, but with greater emphasis on the configuration by convention.
Maven is hosted by the `Apache Software Foundation`__, and can be found at: http://maven.apache.org.
__ http://www.apache.org
The main goals of Maven are:
- Facilitate the process of compilation and construction of the project.
- Generate quality documentation for the project.
- Provide development guidelines based on best practices.
- To facilitate seamless migration to new features of Maven.
Setting up a Maven project is done through the *pom.xml* file, which describes the main properties of the project and its dependencies with other modules and external components, as well as the Maven configuration to be applied. On the Maven website there is a `reference guide on the pom.xml file format`__
__ http://maven.apache.org/pom.html
Following the philosophy of configuration by convention, Maven defines a `standard project structure`__::
project
|-- pom.xml
`-- src
|-- main
| |-- java
| `-- resources
|
`-- test
|-- java
`-- resources
If we follow this structure (but if it is different, it can be configured) with a basic configuration, we can perform the typical tasks of any Java project, already predefined in Maven:
- Compilation of code.
- Packaging in *.jar*, *.war* or *.ear* files.
- Generation of javadoc and other reports.
- Implementation of unit tests.
- etc.
__ http://maven.apache.org/guides/introduction/introduction-to-the-standard-directory-layout.html
Each task is determined by a Maven *objective*, with its name passed as a parameter. Example::
mvn install
There are two main versions of Maven: 1.0 and 2.0. The latter version is used in gvSIG.