Professional Documents
Culture Documents
MavenEnvironmentSetup
MavenEnvironmentSetup
Advertisements
PreviousPage
NextPage
MavenisJavabasedtool,sotheveryfirstrequirementistohaveJDKinstalledon
yourmachine.
SystemRequirement
JDK
1.5orabove.
Memory
nominimumrequirement.
DiskSpace
nominimumrequirement.
OperatingSystem
nominimumrequirement.
Step1verifyJavainstallationonyourmachine
Nowopenconsoleandexecutethefollowingjavacommand.
OS
Task
Command
Windows
OpenCommandConsole
c:\>javaversion
Linux
OpenCommandTerminal
$javaversion
Mac
OpenTerminal
machine:~joseph$javaversion
Let'sverifytheoutputforalltheoperatingsystems:
OS
Output
Windows
javaversion"1.7.0_75"
Java(TM)SERuntimeEnvironment(build1.7.0_75b13)
Java HotSpot(TM) Client VM (build 24.75b04, mixed mode,
http://www.tutorialspoint.com/maven/maven_environment_setup.htm
1/6
17/11/2015
MavenEnvironmentSetup
sharing)
Linux
javaversion"1.7.0_75"
Java(TM)SERuntimeEnvironment(build1.7.0_75b13)
Java HotSpot(TM) Client VM (build 24.75b04, mixed mode,
sharing)
Mac
javaversion"1.7.0_75"
Java(TM)SERuntimeEnvironment(build1.7.0_75b13)
Java HotSpot(TM)64Bit Server VM (build 24.75b04, mixed
mode,sharing)
IfyoudonothaveJavainstalled,installtheJavaSoftwareDevelopmentKit(SDK)
from
http://www.oracle.com/technetwork/java/javase/downloads/index.html
WeareassumingJava1.7.0_75asinstalledversionforthistutorial.
Step2:SetJAVAenvironment
SettheJAVA_HOMEenvironmentvariabletopointtothebasedirectorylocation
whereJavaisinstalledonyourmachine.Forexample
OS
Output
Windows
SettheenvironmentvariableJAVA_HOMEtoC:\Program
Files\Java\jdk1.7.0_75
Linux
exportJAVA_HOME=/usr/local/javacurrent
Mac
exportJAVA_HOME=/Library/Java/Home
AppendJavacompilerlocationtoSystemPath.
OS
Output
Windows
AppendthestringC:\ProgramFiles\Java\jdk1.7.0_75\bintothe
endofthesystemvariable,Path.
Linux
exportPATH=$PATH:$JAVA_HOME/bin/
Mac
notrequired
http://www.tutorialspoint.com/maven/maven_environment_setup.htm
2/6
17/11/2015
MavenEnvironmentSetup
VerifyJavaInstallationusingjavaversioncommandexplainedabove.
Step3:DownloadMavenarchive
DownloadMaven3.3.3fromhttp://maven.apache.org/download.cgi
OS
Archivename
Windows
apachemaven3.3.3bin.zip
Linux
apachemaven3.3.3bin.tar.gz
Mac
apachemaven3.3.3bin.tar.gz
Step4:ExtracttheMavenarchive
Extract the archive, to the directory you wish to install Maven 3.3.3. The
subdirectoryapachemaven3.3.3willbecreatedfromthearchive.
OS
Location(canbedifferentbasedonyourinstallation)
Windows
C:\ProgramFiles\ApacheSoftwareFoundation\apachemaven3.3.3
Linux
/usr/local/apachemaven
Mac
/usr/local/apachemaven
Step5:SetMavenenvironmentvariables
AddM2_HOME,M2,MAVEN_OPTStoenvironmentvariables.
OS
Output
Windows
Settheenvironmentvariablesusingsystemproperties.
M2_HOME=C:\Program
Files\Apache
Software
Foundation\apachemaven3.3.3
M2=%M2_HOME%\bin
MAVEN_OPTS=Xms256mXmx512m
Linux
Opencommandterminalandsetenvironmentvariables.
export
M2_HOME=/usr/local/apachemaven/apachemaven
3.3.3
http://www.tutorialspoint.com/maven/maven_environment_setup.htm
3/6
17/11/2015
MavenEnvironmentSetup
exportM2=$M2_HOME/bin
exportMAVEN_OPTS=Xms256mXmx512m
Mac
Opencommandterminalandsetenvironmentvariables.
export
M2_HOME=/usr/local/apachemaven/apachemaven
3.3.3
exportM2=$M2_HOME/bin
exportMAVEN_OPTS=Xms256mXmx512m
Step6:AddMavenbindirectorylocationtosystem
path
NowappendM2variabletoSystemPath
OS
Output
Windows
Appendthestring%M2%totheendofthesystemvariable,Path.
Linux
exportPATH=$M2:$PATH
Mac
exportPATH=$M2:$PATH
Step8:VerifyMaveninstallation
Nowopenconsole,executethefollowingmvncommand.
OS
Task
Command
Windows
OpenCommandConsole
c:\>mvnversion
Linux
OpenCommandTerminal
$mvnversion
Mac
OpenTerminal
machine:~joseph$mvnversion
Finally, verify the output of the above commands, which should be something as
follows:
OS
Output
Windows
ApacheMaven3.3.3
http://www.tutorialspoint.com/maven/maven_environment_setup.htm
4/6
17/11/2015
MavenEnvironmentSetup
(7994120775791599e205a5524ec3e0dfe41d4a06201504
22T17:27:37+05:30)
Maven
home:
C:\Program
Files\Apache
Software
Foundation\apachemaven3.3.3
Javaversion:1.7.0_75,vendor:OracleCorporation
Javahome:C:\ProgramFiles\Java\jdk1.7.0_75\jre
Defaultlocale:en_US,platformencoding:Cp1252
Linux
ApacheMaven3.3.3
(7994120775791599e205a5524ec3e0dfe41d4a06201504
22T17:27:37+05:30)
Mavenhome:/usr/local/apachemaven/apachemaven3.3.3
Javaversion:1.7.0_75,vendor:OracleCorporation
Javahome:/usr/local/javacurrent/jdk1.7.0_75/jre
Mac
ApacheMaven3.3.3
(7994120775791599e205a5524ec3e0dfe41d4a06201504
22T17:27:37+05:30)
Mavenhome:/usr/local/apachemaven/apachemaven3.3.3
Javaversion:1.7.0_75,vendor:OracleCorporation
Javahome:/Library/Java/Home/jdk1.7.0_75/jre
Congratulations!youarenowallsettouseApacheMavenforyourprojects.
PreviousPage
NextPage
Advertisements
Write for us
FAQ's
Helping
Contact
5/6
17/11/2015
MavenEnvironmentSetup
http://www.tutorialspoint.com/maven/maven_environment_setup.htm
go
6/6