maven 安装

linux环境

下载页: http://maven.apache.org/download.cgi

  1. 选择所需要的版本进行下载。
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: ‘apache-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) - ‘apache-maven-3.6.0-bin.tar.gz’ saved [9063587/9063587]

  1. 解压
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  
  1. 配置环境变量
vim /etc/profile
#增加如下两行
export MAVEN_HOME=/usr/zm/sources/apache-maven-3.6.0
export PATH=$PATH:$MAVEN_HOME/bin
#保存不了,只读权限,需要修改权限

zm@ubuntu:/usr/zm/sources$ sudo -i
[sudo] password for zm:#输入密码
root@ubuntu:~# chmod  777 /etc/profile
#修改文件profile,并保存
root@ubuntu:~# source /etc/profile
  1. 检查是否安装成功
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环境

下载页: http://maven.apache.org/download.cgi
解压到某个目录下。
配置环境变量,步骤

  1. 右键单击桌面上的计算机,选择属性


    maven 安装_第1张图片
    image.png
  2. 进入系统界面,选择高级系统设置


    maven 安装_第2张图片
    image.png
  3. 进入系统属性,点击环境变量


    maven 安装_第3张图片
    image.png
  4. 找到系统变量里面的Path


    maven 安装_第4张图片
    image.png
  5. 双击修改变量值


    maven 安装_第5张图片
    image.png
  6. 在行尾加入maven配置,即maven的bin目录,如图:
    ;E:\installed\develop\apache-maven-3.6.0\bin
  7. 点击确定。
  8. 验证,使用命令 mvn --version,得到如下输出,表示安装成功


    maven 安装_第6张图片
    image.png

你可能感兴趣的:(maven 安装)