linux環(huán)境
下載頁: http://maven.apache.org/download.cgi
- 選擇所需要的版本進(jìn)行下載。
zm@ubuntu:/usr/zm/sources$ wget http://mirrors.tuna.tsinghua.edu.cn/apache/maven/maven-3/3.6.0/binaries/apache-maven-3.6.0-bin.tar.gz
--2019-04-10 20:25:39-- http://mirrors.tuna.tsinghua.edu.cn/apache/maven/maven-3/3.6.0/binaries/apache-maven-3.6.0-bin.tar.gz
Resolving mirrors.tuna.tsinghua.edu.cn (mirrors.tuna.tsinghua.edu.cn)... 101.6.8.193, 2402:f000:1:408:8100::1
Connecting to mirrors.tuna.tsinghua.edu.cn (mirrors.tuna.tsinghua.edu.cn)|101.6.8.193|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 9063587 (8.6M) [application/x-gzip]
Saving to: ‘a(chǎn)pache-maven-3.6.0-bin.tar.gz’
apache-maven-3.6.0-bin.tar.gz 100%[===================================================================================================================>] 8.64M 2.14MB/s in 4.1s
2019-04-10 20:25:43 (2.12 MB/s) - ‘a(chǎn)pache-maven-3.6.0-bin.tar.gz’ saved [9063587/9063587]
- 解壓
zm@ubuntu:/usr/zm/sources$ tar -xvf apache-maven-3.6.0-bin.tar.gz
apache-maven-3.6.0/README.txt
apache-maven-3.6.0/LICENSE
apache-maven-3.6.0/NOTICE
apache-maven-3.6.0/lib/
apache-maven-3.6.0/lib/animal-sniffer-annotations.license
apache-maven-3.6.0/lib/checker-compat-qual.license
apache-maven-3.6.0/lib/jcl-over-slf4j.license
apache-maven-3.6.0/lib/jsr250-api.license
apache-maven-3.6.0/lib/org.eclipse.sisu.inject.license
apache-maven-3.6.0/lib/org.eclipse.sisu.plexus.license
apache-maven-3.6.0/lib/slf4j-api.license
apache-maven-3.6.0/lib/jansi-native/
apache-maven-3.6.0/lib/jansi-native/freebsd32/
apache-maven-3.6.0/lib/jansi-native/freebsd64/
apache-maven-3.6.0/lib/jansi-native/linux32/
apache-maven-3.6.0/lib/jansi-native/linux64/
apache-maven-3.6.0/lib/jansi-native/osx/
apache-maven-3.6.0/lib/jansi-native/windows32/
apache-maven-3.6.0/lib/jansi-native/windows64/
apache-maven-3.6.0/lib/jansi-native/freebsd32/libjansi.so
apache-maven-3.6.0/lib/jansi-native/freebsd64/libjansi.so
apache-maven-3.6.0/lib/jansi-native/linux32/libjansi.so
apache-maven-3.6.0/lib/jansi-native/linux64/libjansi.so
apache-maven-3.6.0/lib/jansi-native/osx/libjansi.jnilib
apache-maven-3.6.0/lib/jansi-native/windows32/jansi.dll
apache-maven-3.6.0/lib/jansi-native/windows64/jansi.dll
apache-maven-3.6.0/bin/m2.conf
apache-maven-3.6.0/bin/mvn.cmd
apache-maven-3.6.0/bin/mvnDebug.cmd
apache-maven-3.6.0/bin/mvn
apache-maven-3.6.0/bin/mvnDebug
apache-maven-3.6.0/bin/mvnyjp
apache-maven-3.6.0/conf/
apache-maven-3.6.0/conf/logging/
apache-maven-3.6.0/conf/logging/simplelogger.properties
apache-maven-3.6.0/conf/settings.xml
apache-maven-3.6.0/conf/toolchains.xml
apache-maven-3.6.0/lib/ext/
apache-maven-3.6.0/lib/jansi-native/
apache-maven-3.6.0/lib/ext/README.txt
apache-maven-3.6.0/lib/jansi-native/README.txt
apache-maven-3.6.0/boot/plexus-classworlds-2.5.2.jar
apache-maven-3.6.0/lib/maven-embedder-3.6.0.jar
apache-maven-3.6.0/lib/maven-settings-3.6.0.jar
apache-maven-3.6.0/lib/plexus-utils-3.1.0.jar
apache-maven-3.6.0/lib/maven-settings-builder-3.6.0.jar
apache-maven-3.6.0/lib/maven-builder-support-3.6.0.jar
apache-maven-3.6.0/lib/plexus-interpolation-1.25.jar
apache-maven-3.6.0/lib/plexus-component-annotations-1.7.1.jar
apache-maven-3.6.0/lib/plexus-sec-dispatcher-1.4.jar
apache-maven-3.6.0/lib/plexus-cipher-1.7.jar
apache-maven-3.6.0/lib/maven-core-3.6.0.jar
apache-maven-3.6.0/lib/maven-model-3.6.0.jar
apache-maven-3.6.0/lib/maven-repository-metadata-3.6.0.jar
apache-maven-3.6.0/lib/maven-artifact-3.6.0.jar
apache-maven-3.6.0/lib/commons-lang3-3.8.1.jar
apache-maven-3.6.0/lib/maven-plugin-api-3.6.0.jar
apache-maven-3.6.0/lib/org.eclipse.sisu.plexus-0.3.3.jar
apache-maven-3.6.0/lib/cdi-api-1.0.jar
apache-maven-3.6.0/lib/jsr250-api-1.0.jar
apache-maven-3.6.0/lib/javax.inject-1.jar
apache-maven-3.6.0/lib/org.eclipse.sisu.inject-0.3.3.jar
apache-maven-3.6.0/lib/maven-model-builder-3.6.0.jar
apache-maven-3.6.0/lib/maven-resolver-provider-3.6.0.jar
apache-maven-3.6.0/lib/maven-resolver-api-1.3.1.jar
apache-maven-3.6.0/lib/maven-resolver-spi-1.3.1.jar
apache-maven-3.6.0/lib/maven-resolver-util-1.3.1.jar
apache-maven-3.6.0/lib/maven-resolver-impl-1.3.1.jar
apache-maven-3.6.0/lib/slf4j-api-1.7.25.jar
apache-maven-3.6.0/lib/maven-shared-utils-3.2.1.jar
apache-maven-3.6.0/lib/commons-io-2.5.jar
apache-maven-3.6.0/lib/guice-4.2.1-no_aop.jar
apache-maven-3.6.0/lib/aopalliance-1.0.jar
apache-maven-3.6.0/lib/guava-25.1-android.jar
apache-maven-3.6.0/lib/jsr305-3.0.2.jar
apache-maven-3.6.0/lib/checker-compat-qual-2.0.0.jar
apache-maven-3.6.0/lib/error_prone_annotations-2.1.3.jar
apache-maven-3.6.0/lib/j2objc-annotations-1.1.jar
apache-maven-3.6.0/lib/animal-sniffer-annotations-1.14.jar
apache-maven-3.6.0/lib/commons-cli-1.4.jar
apache-maven-3.6.0/lib/maven-compat-3.6.0.jar
apache-maven-3.6.0/lib/wagon-provider-api-3.2.0.jar
apache-maven-3.6.0/lib/wagon-http-3.2.0-shaded.jar
apache-maven-3.6.0/lib/jcl-over-slf4j-1.7.25.jar
apache-maven-3.6.0/lib/wagon-file-3.2.0.jar
apache-maven-3.6.0/lib/maven-resolver-connector-basic-1.3.1.jar
apache-maven-3.6.0/lib/maven-resolver-transport-wagon-1.3.1.jar
apache-maven-3.6.0/lib/maven-slf4j-provider-3.6.0.jar
apache-maven-3.6.0/lib/jansi-1.17.1.jar
zm@ubuntu:/usr/zm/sources$ ls
apache-maven-3.6.0 apache-maven-3.6.0-bin.tar.gz
- 配置環(huán)境變量
vim /etc/profile
#增加如下兩行
export MAVEN_HOME=/usr/zm/sources/apache-maven-3.6.0
export PATH=$PATH:$MAVEN_HOME/bin
#保存不了港粱,只讀權(quán)限坡氯,需要修改權(quán)限
zm@ubuntu:/usr/zm/sources$ sudo -i
[sudo] password for zm:#輸入密碼
root@ubuntu:~# chmod 777 /etc/profile
#修改文件profile,并保存
root@ubuntu:~# source /etc/profile
- 檢查是否安裝成功
root@ubuntu:~# mvn -version
Apache Maven 3.6.0 (97c98ec64a1fdfee7767ce5ffb20918da4f719f3; 2018-10-24T11:41:47-07:00)
Maven home: /usr/zm/sources/apache-maven-3.6.0
Java version: 1.8.0_11, vendor: Oracle Corporation, runtime: /usr/zm/sources/jdk1.8.0_11/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "4.13.0-31-generic", arch: "amd64", family: "unix"
安裝完成。
Windows環(huán)境
下載頁: http://maven.apache.org/download.cgi
解壓到某個(gè)目錄下。
配置環(huán)境變量,步驟
-
右鍵單擊桌面上的計(jì)算機(jī)撕氧,選擇屬性
-
進(jìn)入系統(tǒng)界面,選擇高級(jí)系統(tǒng)設(shè)置
-
進(jìn)入系統(tǒng)屬性喇完,點(diǎn)擊環(huán)境變量
-
找到系統(tǒng)變量里面的Path
-
雙擊修改變量值
- 在行尾加入maven配置伦泥,即maven的bin目錄,如圖:
;E:\installed\develop\apache-maven-3.6.0\bin - 點(diǎn)擊確定锦溪。
-
驗(yàn)證不脯,使用命令 mvn --version,得到如下輸出刻诊,表示安裝成功