note:网上已经有很多该类型教程了,这边自身保留一份,方便后面使用;
一、安装地址:官网
二、安装步骤
$ tar -xvf apache-maven-3.3.9-bin.tar.gz //mac支持手动点击解压
$ sudo mv -f apache-maven-3.3.9 /usr/local/ //这个路由随意配置文件指向就可以了。
2.1执行命令
sudo vim /etc/profile //打开该配置文件,添加下面2个配置:
export MAVEN_HOME=/usr/local/apache-maven-3.9.6
export PATH=${PATH}:${MAVEN_HOME}/bin配置好了之后,执行:$ source /etc/profile
三、验证结果: mvn -v
Apache Maven 3.9.6 (bc0240f3c744dd6b6ec2920b3cd08dcc295161ae)
Maven home: /usr/local/apache-maven-3.9.6
Java version: 17.0.5, vendor: Amazon.com Inc., runtime: /Users/caolonglong/Library/Java/JavaVirtualMachines/corretto-17.0.5/Contents/Home
Default locale: zh_CN_#Hans, platform encoding: UTF-8
OS name: "mac os x", version: "12.3", arch: "x86_64", family: "mac"