Maven - Maven Environment Setup - maven tutorial




maven tutorial tags : apache maven , maven repository , maven central

How to setup/install Maven Environment ?

  • In computer program and software product development, the developmentenvironment is the set of processes and programming tools used to create the program or software product. The term may sometimes also imply the physicalenvironment.
  • Maven is Java based tool, so the very first requirement is to have JDK installed on your machine.

System Requirement

JDK 1.5 or above.
Memory no minimum requirement.
Disk Space no minimum requirement.
Operating System no minimum requirement.

Step 1 - verify Java installation on your machine

  • Now open console and execute the following java command.
OS TaskCommand
Windows Open Command Console c:\> java -version
Linux Open Command Terminal $ java -version
Mac Open Terminal machine:~ joseph$ java -version
  • Let's verify the output for all the operating systems:
OS Output
Windows java version "1.7.0_75"

Java(TM) SE Runtime Environment (build 1.7.0_75-b13)

Java HotSpot(TM) Client VM (build 24.75-b04, mixed mode, sharing)

Linux java version "1.7.0_75"

Java(TM) SE Runtime Environment (build 1.7.0_75-b13)

Java HotSpot(TM) Client VM (build 24.75-b04, mixed mode, sharing)

Mac java version "1.7.0_75"

Java(TM) SE Runtime Environment (build 1.7.0_75-b13)

Java HotSpot(TM)64-Bit Server VM (build 24.75-b04, mixed mode, sharing)

  • Install the java Software Development Kit (SDK) .

Step 2: Set JAVA environment

  • Set the JAVA_HOME environment variable to point to the base directory location where Java is installed on your machine.
OS Output
Windows Set the environment variable JAVA_HOME to C:\Program Files\Java\jdk1.7.0_75
Linux export JAVA_HOME=/usr/local/java-current
Mac export JAVA_HOME=/Library/Java/Home
  • Append Java compiler location to System Path.
OS Output
Windows Append the string ;C:\Program Files\Java\jdk1.7.0_75\bin to the end of the system variable, Path.
Linux export PATH=$PATH:$JAVA_HOME/bin/
Mac not required
  • Verify Java Installation using java -version command explained above.

Step 3: Download Maven archive

OS Archive name
Windows apache-maven-3.3.3-bin.zip
Linux apache-maven-3.3.3-bin.tar.gz
Mac apache-maven-3.3.3-bin.tar.gz

Step 4: Extract the Maven archive

  • Extract the archive, to the directory you wish to install Maven 3.3.3. The subdirectory apache-maven-3.3.3 will be created from the archive.
OS Location (can be different based on your installation)
Windows C:\Program Files\Apache Software Foundation\apache-maven-3.3.3
Linux /usr/local/apache-maven
Mac /usr/local/apache-maven

Step 5: Set Maven environment variables

  • Add M2_HOME, M2, MAVEN_OPTS to environment variables.
OSOutput
Windows Set the environment variables using system properties.

M2_HOME=C:\Program Files\Apache Software Foundation\apache-maven-3.3.3

M2=%M2_HOME%\bin

MAVEN_OPTS=-Xms256m -Xmx512m

Linux Open command terminal and set environment variables.

export M2_HOME=/usr/local/apache-maven/apache-maven-3.3.3

export M2=$M2_HOME/bin

export MAVEN_OPTS=-Xms256m -Xmx512m

Mac Open command terminal and set environment variables.

export M2_HOME=/usr/local/apache-maven/apache-maven-3.3.3

export M2=$M2_HOME/bin

export MAVEN_OPTS=-Xms256m -Xmx512m

Step 6: Add Maven bin directory location to system path

  • Now append M2 variable to System Path
OS Output
Windows Append the string ;%M2% to the end of the system variable, Path.
Linux export PATH=$M2:$PATH
Mac export PATH=$M2:$PATH
maven tutorial tags : apache maven , maven repository , maven central

Step 7: Verify Maven installation

  • Now open console, execute the following mvn command.
OS Task Command
Windows Open Command Console c:\> mvn --version
Linux Open Command Terminal $ mvn --version
Mac Open Terminal machine:~ joseph$ mvn --version
  • Finally, verify the output of the above commands, which should be something as follows:
OS Output
Windows Apache Maven 3.3.3 (7994120775791599e205a5524ec3e0dfe41d4a06; 2015-04-22T17:27:37+05:30)

Maven home: C:\Program Files\Apache Software Foundation\apache-maven-3.3.3

Java version: 1.7.0_75, vendor: Oracle Corporation

Java home: C:\Program Files\Java\jdk1.7.0_75\jre

Default locale: en_US, platform encoding: Cp1252

Linux Apache Maven 3.3.3 (7994120775791599e205a5524ec3e0dfe41d4a06; 2015-04-22T17:27:37+05:30)

Maven home: /usr/local/apache-maven/apache-maven-3.3.3

Java version: 1.7.0_75, vendor: Oracle Corporation

Java home: /usr/local/java-current/jdk1.7.0_75/jre

Mac Apache Maven 3.3.3 (7994120775791599e205a5524ec3e0dfe41d4a06; 2015-04-22T17:27:37+05:30)

Maven home: /usr/local/apache-maven/apache-maven-3.3.3

Java version: 1.7.0_75, vendor: Oracle Corporation

Java home: /Library/Java/Home/jdk1.7.0_75/jre


Wikitechy provides an indepth knowledge on the below maven tutorial items such as maven download , maven install , maven goals , maven build , maven commands , maven plugin , maven search , maven eclipse , maven deploy , eclipse maven , maven junit , maven java , hibernate maven , maven project , java maven , maven version , maven proxy , maven 2 , maven pom , maven eclipse plugin , maven java version , maven properties , maven install windows , how to create maven project in eclipse , eclipse maven plugin , maven dependencies , what is maven in java , maven apache , maven project structure , how to install maven in eclipse

Related Searches to Maven Environment Setup

Adblocker detected! Please consider reading this notice.

We've detected that you are using AdBlock Plus or some other adblocking software which is preventing the page from fully loading.

We don't have any banner, Flash, animation, obnoxious sound, or popup ad. We do not implement these annoying types of ads!

We need money to operate the site, and almost all of it comes from our online advertising.

Please add wikitechy.com to your ad blocking whitelist or disable your adblocking software.

×