https://maven.apache.org
Apache Maven is a software project management and comprehension tool. Based on the concept of a project object model (POM), Maven can manage a project’s build, reporting and documentation from a central piece of information.
The Project Object Model (POM) describe the project, his dependencies with external module and the order needed to buid it. Maven has native ability as Java code compilation or modulatirty.
Install Maven
$ sudo apt-get install maven
Check the installed maven’s version:
$ mvn -v
Apache Maven 3.0.5
Maven home: /usr/share/maven
Java version: 1.7.0_79, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-7-openjdk-amd64/jre
Default locale: fr_FR, platform encoding: UTF-8
OS name: "linux", version: "3.16.0-43-generic", arch: "amd64", family: "unix"
USING MAVEN
A fresh build of a project generating all packaged outputs and the documentation site and deploying it to a repository manager could be done with
$ mvn clean deploy site-deploy
You will find configuration files in
/etc/maven
2 important files : m2.conf settings.xml
The default repository is
~/.m2/repository/
You should creat a directory to share the files used by maven (example with jenkins)
So create /opt/maven-work
and make some change in
setting.xml
$vi /etc/maven/settings.xml
and had this line
/opt/mvn-work
About the MAVEN_HOME :
You must look for /usr/share/maven or /usr/share/maven2
there you ll find :
bin boot conf lib man
If you want to configurate JENKINS with MAVEN : see our post
Just creating the package and installing it in the local repository for re-use from other projects can be done with
$ mvn clean install
This is the most common build invocation for a Maven project.
When not working with a project, and in some other use cases, you might want to invoke a specific task implemented by a part of Maven – this is called a goal of a plugin. E.g.:
$ mvn archetype:generate
or
$ mvn checkstyle:check
There are many different plugins avaiable and they all implement different goals.