Download maven.
Windows OS:
- Unzip the distribution archive, i.e. apache-maven-3.0.4-bin.zip to the directory you wish to install Maven 3.0.4. These instructions assume you chose C:\Program Files\Apache Software Foundation. The subdirectory apache-maven-3.0.4 will be created from the archive.
- Add the M2_HOME environment variable. [almost similar as this]: adding the M2_HOME variable in the system variables with the value C:\Program Files\Apache Software Foundation\apache-maven-3.0.4. Be sure to omit any quotation marks around the path even if it contains spaces.
- In the same dialog, add the M2 environment variable in the system variables with the value %M2_HOME%\bin.
- In the same dialog, update/create the Path environment variable in the system variables and prepend the value %M2% to add Maven available in the command line.
- In the same dialog, make sure that JAVA_HOME exists in your system variables and it is set to the location of your JDK, e.g.C:\Program Files\Java\jdk1.5.0_02 and that %JAVA_HOME%\bin is in your Path environment variable.
- Open a new command prompt and run mvn --version to verify that it is correctly installed.
Linux based/Ubuntu Operating Systems:
- Extract the distribution archive, to the directory you wish to install Maven 3.0.4. These instructions assume you chose /home/username/java/tools/maven.
- Open terminal and type: gedit ~/.bashrc
- Set environment variable by adding the following lines at the bottom of .bashrc :
- export M2_HOME=/home/username/java/tools/maven
- export M2=$M2_HOME/bin
- export PATH=$M2:$PATH
- export JAVA_HOME=/usr/lib/jvm/jdk-default #if JAVA_HOME not exist.
- Run mvn --version to verify that it is correctly installed.
No comments:
Post a Comment