官术网_书友最值得收藏!

Installing Maven

Maven is neither a part of the operating system nor the JDK. It has to be downloaded and installed in a very similar way to Ant. You can download Maven from its official website (https://maven.apache.org/) under the download section. Currently, the latest stable version is 3.3.9. When you download it, the actual release may be different; instead, use the latest stable version. You can download the source or the precompiled version. The easiest way is to download the binary in tar.gz format.

I cannot skip drawing your attention to the importance of checking the download integrity using checksums. I have detailed the way to do it in the section about Ant installation.

After the file is downloaded, you can explode it to a subdirectory using the following command:

tar xfz apache-maven-3.3.9-bin.tar.gz

The created subdirectory is the usable binary distribution of Maven. Usually, I move it under ~/bin, making it available only for my user on OS X. After that, you should add the bin directory of the installation to the PATH. To do that, you should edit the ~/.bashrc file and add the following lines to it:

export M2_HOME=~/bin/apache-maven-3.3.9/ 
export PATH=${M2_HOME}bin:$PATH

Then, restart the terminal application, or just type . ~/.bashrc and test the installation of Maven typing, as follows:

    $ mvn -v
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T17:41:47+01:00)
Maven home: /Users/verhasp/bin/apache-maven-3.3.9
Java version: 9-ea, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk-9.jdk/Contents/Home
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.11.6", arch: "x86_64", family: "mac"

You should see a similar message on the screen that displays the installed Maven version and other information.

主站蜘蛛池模板: 岳普湖县| 明溪县| 扎鲁特旗| 郓城县| 多伦县| 罗源县| 华亭县| 中方县| 读书| 肥东县| 镇雄县| 林西县| 元氏县| 南江县| 布尔津县| 象山县| 汝城县| 大姚县| 乌兰浩特市| 凉山| 遂平县| 汶川县| 两当县| 福清市| 南平市| 松溪县| 文安县| 鹤山市| 浏阳市| 寻乌县| 阿勒泰市| 富顺县| 兴仁县| 文昌市| 禹城市| 开原市| 阿克陶县| 清新县| 巴林左旗| 纳雍县| 东台市|