|Maven is a Java project management and project comprehension tool. It's primary goal is to make the developers life easier by providing a well defined project structure, well defined development processes to follow, and a coherent body of documentation that keeps your developers and clients apprised of what's happening with your project.
Maven is distributed at no charge for commercial or non-commercial use and is licensed under the Apache License, Version 2.0.
More information about Maven can be found at: http://maven.apache.org
The latest Maven version can be downloaded from: http://maven.apache.org/download.html
Operating system used
Windows Vista Home Premium SP 2
Maven 3.0 or higher.
- A maven command looks like:
mvn <phase> <plugin-prefix>:<goal> <phase> ....
The above mentioned phase, plugin-prefix, goal, groupId, artifactId and plugin-version can be found in the pom.xml and effective pom.xml.
Example effective pom.xml:
Every goal is a specific task executed by a plugin.
A plugin generally provides a set of goals and can be referenced by its plugin-prefix.
- An official maven artifactId always starts with the word "maven":
In this example, to execute the "compile" goal, you can type:
- or -
- If you create your own plugin you must NEVER start with the word "maven".
You will typically name your plugin:
A maven build lifecycle is the order of phases (<phase>..</phase>) defined in the effective pom.xml. Available maven lifecycle phases are:
Not all phases can be used, see your effective pom.xml which phases you can use. When a phase is called via maven command line, for example mvn compile, only phases upto and including that phase (as specified in the effective pom.xml) will be executed.
If you look at this effective pom.xml the following phases are defined (in this order):
If you type: mvn install
It will execute the following phases (in this order): test-compile, compile, clean and install.
If you type: mvn compile
It will execute the following phases (in this order): test-compile, compile.
If you type: mvn test
It will execute the following phases (in this order): test-compile, compile, clean, install, process-resources, process-test-resources and test.
Each phase in turn has one or more goals (see <goal>..</goal> in your effective pom.xml), which will be executed in the order specified in the effective pom.xml.
If you only want to execute a specific goal, type: mvn <plugin-prefix>:<goal>
For example: mvn compiler:compile
Maven executes the phases and/or goals in the order they are specified in the command line.
- If you want to know more about a groupId:artifactId, plugin or cmd, use the maven help plugin. You must specify either: both "groupId" and "artifactId" parameters OR a "plugin" parameter OR a "cmd" parameter. For instance:
- mvn help:describe -Dcmd=install
- mvn help:describe -Dcmd=help:describe
- mvn help:describe -Dplugin=org.apache.maven.plugins:maven-help-plugin
- mvn help:describe -DgroupId=org.apache.maven.plugins -DartifactId=maven-help-plugin
- mvn help:describe -Dgoal=compile -DartifactId=maven-compiler-plugin -DgroupId=org.apache.maven.plugins -Ddetail
- mvn help:describe -DgroupId=org.mortbay.jetty -DartifactId=jetty-maven-plugin -Dgoal=run -Ddetail
- mvn help:help -Ddetail=true