• Mac上安装 Maven


    http://www.tuicool.com/articles/ZV3yUn

    Recently I upgraded my Mac OS X to Mavericks (10.9) and I was surprised to see that it doesn’t come with Maven. Earlier versions of Mac OS X such as Lion and Mountain Lion used to have maven installed by default.

    There are some third party options such as HomeBrew and using XCode to install Maven on Mac OS X Mavericks but I wanted to do it myself without relying on another software for getting maven working.

    Here are the steps that I used to install maven on Mac OS X Mavericks.

    Step 1 : Download Maven binaries from Maven Download Page . I was using Maven 3.0.5, so I downloaded apache-maven-3.0.5-bin.tar.gz.

    Step 2 : You can install Maven at any location but since it’s a one time process, I didn’t wanted it in my user directory. So I installed it in /usr/local directory. You might have to use sudo command to install in /usr/local directory if you are getting permission denied error.

    $ cd /usr/local
    $ sudo mv /Users/pankaj/Downloads/apache-maven-3.0.5-bin.tar.gz ./
    $ sudo tar -xvf apache-maven-3.0.5-bin.tar.gz

    Step 3 : Now open the bash profile file and add following lines into it. Usually profile file names are .bash_profile or .profile, use whichever you have in your system. If you don’t have profile file, you will have to create one with vi command.

    $ cd $HOME
    $ vi .bash_profile
    #Add below lines in the profile
    export M2_HOME=/usr/local/apache-maven-3.0.5
    export PATH=$PATH:$M2_HOME/bin
    #save and quit
    $ source .bash_profile

    That’s it, maven is installed on your latest Mac OS X and you can verify it by issuing below command.

    $ mvn --version
    Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19 05:51:28-0800)
    Maven home: /usr/local/apache-maven-3.0.5
    Java version: 1.7.0_09, vendor: Oracle Corporation
    Java home: /Library/Java/JavaVirtualMachines/jdk1.7.0_09.jdk/Contents/Home/jre
    Default locale: en_US, platform encoding: UTF-8
    OS name: "mac os x", version: "10.9", arch: "x86_64", family: "mac"

    You can use this method to install any maven version you would like to use and at your specified location.

    Let me know if you find any issues with above setup steps

  • 相关阅读:
    那些年搞不懂的多线程、同步异步及阻塞和非阻塞(一)---多线程简介
    java中IO流详细解释
    Java IO流学习总结
    MySQL数据库中索引的数据结构是什么?(B树和B+树的区别)
    使用Redis存储Nginx+Tomcat负载均衡集群的Session
    Redis 3.2.4集群搭建
    JDK1.8源码分析之HashMap
    java HashMap和LinkedHashMap区别
    Java中原子类的实现
    多线程-传统定时任务
  • 原文地址:https://www.cnblogs.com/wind90/p/4767863.html
Copyright © 2020-2023  润新知