• Linux (Ubuntu)上面安装maven


    1 首先检查linux上是否有maven

    mvn -v

    或者mvn -version

    如果没有安装,提示如下:

    ubuntu@ip-172-31-29-46:~$ mvn -v
    The program 'mvn' can be found in the following packages:
     * maven
     * maven2
    Try: sudo apt-get install <selected package>

    如果有安装,提示如下:

    cfj@cfj-virtual-machine:/opt$ mvn -v
    Apache Maven 3.5.4 (1edded0938998edf8bf061f1ceb3cfdeccf443fe; 2018-06-18T02:33:14+08:00)
    Maven home: /opt/apache-maven-3.5.4
    Java version: 1.8.0_181, vendor: Oracle Corporation, runtime: /usr/lib/jvm/java-8-oracle/jre
    Default locale: zh_CN, platform encoding: UTF-8
    OS name: "linux", version: "4.15.0-32-generic", arch: "amd64", family: "unix"

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

    选择.tar.gz文件

    3 将下载的文件上传到linux 的/opt 文件夹下面

    解压该压缩文件:sudo tar -zxvf apache-maven-3.5.4-bin.tar.gz

    解压之后得到apache-maven-3.5.4/ 文件夹

    4 配置环境变量

    sudo vi /etc/profile

    添加

    export M2_HOME=/opt/apache-maven-3.5.4
    export PATH=$PATH:$M2_HOME/bin

    添加完成之后重启环境变量使之生效

    source /etc/profile

    5 检查maven版本看是否安装成功

    mvn -version 或者mvn -v

    ubuntu@ip-172-31-29-46:/opt/apache-maven-3.5.4/conf$ mvn -version
    Apache Maven 3.5.4 (1edded0938998edf8bf061f1ceb3cfdeccf443fe; 2018-06-17T18:33:14Z)
    Maven home: /opt/apache-maven-3.5.4
    Java version: 1.8.0_144, vendor: Oracle Corporation, runtime: /usr/lib/jvm/java-8-oracle/jre
    Default locale: en_US, platform encoding: UTF-8
    OS name: "linux", version: "3.13.0-48-generic", arch: "amd64", family: "unix"

  • 相关阅读:
    绑定方式开始服务&调用服务的方法
    采用服务窃听电话示例
    后台服务运行示例
    Android短信监听器——示例
    利用广播实现ip拨号——示例
    Android图片的合成示例
    IIS 7.5 发布Web 网站步骤
    C# 中 多线程同步退出方案 CancellationTokenSource
    UML 类图常用表示方法.
    Socket Receive 避免 Blocking
  • 原文地址:https://www.cnblogs.com/kxm87/p/9686097.html
Copyright © 2020-2023  润新知