Pages

Maven Installation In Ubuntu


How to Install Maven ?


Prerequisites: 

JAVA 1.5 or above. 

Follow the given link to see how to install java and set environment for java in ubuntu.

http://www.techie-knowledge.co.in/2013/08/installing-java-on-linuxubuntu.html


Installation of Maven on ubuntu can be pretty straightforward 

Type the below commands on terminal.

$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install maven


It takes few minutes to download, patient.

Verification

Type “mvn -version” to verify the installation.
$ mvn -version
Output should something like this-

Apache Maven 3.3.9
Maven home: /usr/share/maven
Java version: 1.8.0_131, vendor: Oracle Corporation
Java home: /opt/jdk1.8.0_131/jre
Default locale: en_IN, platform encoding: UTF-8
OS name: "linux", version: "4.4.0-83-generic", arch: "amd64", family: "unix"


Where the Maven installed?

The apt-get installation will install all the required files in the following folder structure-

  1. /usr/bin/mvn
  2. /usr/share/maven/
  3. /etc/maven   (this is the maven configuration location)

Using maven behind proxy

To use maven behind the proxy we have to define the proxy setting in setting.xml  file inside the proxy element.
The setting file is found in /etc/maven/setting.xml
Add the following line under proxy element

<settings>
<proxies>
<proxy>
<active>true</active>
<protocol>http</protocol>
<host>192.168.1.100</host>
<port>3128</port>
<username>your-username</username>
<password>your-password</password>
</proxy>
</proxies>
</settings>
What is Maven ?