简介
环境要求
Linux 环境
Maven 3.3+ require JDK 1.7
部署形式
- Mac部署Maven形式
Mac部署的形式是应用brew命令来装置maven,命令为brew install maven
因为国内应用比较慢,则须要替换国内源来减速下载。以下更新homebrew-cask时,可能会找不到文件,这是失常状况,可疏忽~
# 替换国内镜像的形式 git -C "$(brew --repo)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git git -C "$(brew --repo homebrew/cask)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask.git brew update
# 国外镜像还原的形式 git -C "$(brew --repo)" remote set-url origin https://github.com/Homebrew/brew.git git -C "$(brew --repo homebrew/core)" remote set-url origin https://github.com/Homebrew/homebrew-core.git git -C "$(brew --repo homebrew/cask)" remote set-url origin https://github.com/Hoapache-maven-3.6.3-bin.tar.gz mebrew/homebrew-cask.git brew update
- Linux 通用形式
通过Maven官网地址: http://maven.apache.org/downl… 下载对应版本压缩文件。
外面会有对应版本的环境要求,比方 Maven 3.3+ require JDK 1.7 及其以上版本才行。见下图。
# 下载好的Maven文件,寄存到/usr/local/目录下 cd /usr/local/ # 将其解压完后,并删除源文件 tar -zxvf apache-maven-3.6.3-bin.tar.gz rm -rf apache-maven-3.6.3-bin.tar.gz # 对该用户配置环境变量 cat >> ~/.bash_profile << EOF export M2_HOME=/usr/local/apache-maven-3.6.3 export PATH=$PATH:$M2_HOME/bin EOF # 对其配置文件失效 source ~/.bash_profile # 校验是否装置胜利 mvn -version