blob: cd821471e3ae50cf920230da54ad53375984cf7c [file] [log] [blame]
# Installing Apache Maven
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
The installation of Apache Maven is a simple process of extracting the archive
and adding the `bin` folder with the `mvn` command to the `PATH`.
Detailed steps are:
* Ensure `JAVA_HOME` environment variable is set and points to your JDK installation
* Extract distribution archive in any directory
```cmd
unzip apache-maven-${currentStableVersion}-bin.zip
```
or
```sh
tar xzvf apache-maven-${currentStableVersion}-bin.tar.gz
```
Alternatively use your preferred archive extraction tool.
* Add the `bin` directory of the created directory `apache-maven-${currentStableVersion}` to
the `PATH` environment variable
* Confirm with `mvn -v` in a new shell. The result should look similar to
```
Apache Maven ${currentStableVersion} (${currentStableVersionDetails})
Maven home: /opt/apache-maven-${currentStableVersion}
Java version: 1.8.0_45, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.8.5", arch: "x86_64", family: "mac"
```
Windows Tips
-----
* Check environment variable value e.g.
```cmd
echo %JAVA_HOME%
C:\Program Files\Java\jdk1.7.0_51
```
* Adding to `PATH`: Add the unpacked distribution's bin directory to your user PATH environment variable
by opening up the system properties (WinKey + Pause), selecting the "Advanced" tab, and
the "Environment Variables" button, then adding or selecting the <i>PATH</i>
variable in the user variables with the value `C:\Program Files\apache-maven-${currentStableVersion}\bin`.
The same dialog can be used to set `JAVA_HOME` to the location of your JDK, e.g. `C:\Program Files\Java\jdk1.7.0_51`
* Open a new command prompt (Winkey + R then type `cmd`) and run `mvn -v` to verify the installation.
Unix-based Operating System (Linux, Solaris and Mac OS X) Tips
-----
* Check environment variable value
```sh
echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home
```
* Adding to `PATH`
```sh
export PATH=/opt/apache-maven-${currentStableVersion}/bin:$PATH
```