博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
How To Install Maven On Mac OSX
阅读量:6696 次
发布时间:2019-06-25

本文共 2357 字,大约阅读时间需要 7 分钟。

hot3.png

Since Lion 10.7.1 10.6.8 MacOSx Snow Leopard (correct me if wrong), Mac OS X comes with Apache Maven 3 built in, and can be located at /usr/share/maven。

(标注:安装Eclipse会自带)

1. Maven Built-In

To verify the Maven installation, in terminal, issue the command mvn -version.

$mvn -version  Apache Maven 3.0.3 (r1075438; 2011-03-01 01:31:09+0800) Maven home: /usr/share/mavenJava version: 1.6.0_33, vendor: Apple Inc.Java home: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/HomeDefault locale: en_US, platform encoding: MacRomanOS name: "mac os x", version: "10.7.4", arch: "x86_64", family: "mac"

1.1 – Where is Maven installed?

A quick check with whereis command :

$ whereis mvn 
/usr/bin/mvn
$ cd /usr/bin 
$$ ls -ls | grep mvn 
8 lrwxr-xr-x 1 root   wheel 24 May 23 15:57 mvn -> /usr/share/maven/bin/mvn

By default, Maven is installed at /usr/share/maven. No configuration is needed.

2. Install Maven Manually

After the upgrade of Mac OS X Mavericks, Maven was removed (no idea why). So, You have to install it manually.

2.1 – Download Maven

Download the , for example apache-maven-3.1.1-bin.tar.gz. Extracts it,

tar -xvf apache-maven-3.1.1-bin.tar.gz  $pwd /Users/mkyong/apache-maven-3.1.1

2.2 – Set Maven command in environment variable.

Update ~/. bash_profile – create this file if doesn’t exist.

$ vim ~/.bash_profile
~/.bash_profile
export M2_HOME=/Users/mkyong/apache-maven-3.1.1 
export PATH=$PATH:$M2_HOME/bin

(标注:按Esc键切换编辑状态与命令状态。在命令状态下,输入:wq回车,代表保存后退出,输入:q!回车,代表不保存就退出)

Restart the terminal. Test it.

$mvn -version  Apache Maven 3.1.1 (0728685237757ffbf44136acec0402957f723d9a; 2013-09-17 23:22:22+0800) Maven home: /Users/mkyong/apache-maven-3.1.1Java version: 1.7.0_05, vendor: Oracle CorporationJava home: /Library/Java/JavaVirtualMachines/1.7.0.jdk/Contents/Home/jreDefault locale: en_US, platform encoding: UTF-8 OS name: "mac os x", version: "10.9", arch: "x86_64", family: "mac"

3. Post Configuration

A common post-installation for Maven, change the local repository to another location.

$sudo vim /usr/share/maven/conf/settings.xml  $vim /usr/mkyong/maven/conf/settings.xml
settings.xml
/path/to/local/repo
--> 
/Users/mkyong//maven/repo/

Above example changed the default repository from ~/.m2/repository to /Users/mkyong//maven/repo/.

References

转载于:https://my.oschina.net/u/1376187/blog/186155

你可能感兴趣的文章
打开hibernate文件报警告
查看>>
linux安装IDEA 2017
查看>>
Intellij IDEA 去掉Mapper文件中的背景
查看>>
Docker 安装 mysql
查看>>
阅读笔记《全景探秘游戏设计艺术》
查看>>
C# Json格式字符串
查看>>
sign-up 签约注册
查看>>
基于RDD实现简单的WordCount程序
查看>>
java8的新特性,Collections.sort(排序的List集合)的使用,对list封装Map里面的某个值进行排序...
查看>>
扩展Ubuntu的系统大小
查看>>
javascript闭包传参和事件的循环绑定
查看>>
gbk字库音序对照表
查看>>
get dc app
查看>>
form 表单
查看>>
POJ 1012 Joseph
查看>>
Nordic Collegiate Programming Contest 2016
查看>>
基础复习-算法设计基础 | 复杂度计算
查看>>
201671010128 2017-09-17《Java程序设计》之步步深入面向对象
查看>>
Linux内核在I386架构下的内存管理
查看>>
构建vue单页应用(一)
查看>>