Maven Install on Mac OS X

后端 未结 24 2033
野性不改
野性不改 2020-11-27 08:46

I\'m trying to install maven through the terminal by following these instructions.

So far I got this

export M2_HOME=/user/apple/apache-maven-3.0.3
ex         


        
相关标签:
24条回答
  • 2020-11-27 09:39

    macOS Sierra onwards

    brew install maven

    0 讨论(0)
  • 2020-11-27 09:42
    brew install maven31 (if you have homebrew)
    
    0 讨论(0)
  • 2020-11-27 09:42

    Open a TERMINAL window and check if you have it already installed.

    Type:

    $ mvn –version
    

    And you should see:

    Apache Maven 3.0.2 (r1056850; 2011-01-09 01:58:10+0100)
    Java version: 1.6.0_24, vendor: Apple Inc.
    Java home: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
    Default locale: en_US, platform encoding: MacRoman
    OS name: “mac os x”, version: “10.6.7″, arch: “x86_64″, family: “mac”
    

    If you don't have Maven installed already, then here is how to download and install maven, and configure environment variables on Mac OS X:

    http://bitbybitblog.com/install-maven-mac/

    0 讨论(0)
  • 2020-11-27 09:43

    This worked for me:

    $ vim .bash_profile

    export JAVA_HOME=$(/usr/libexec/java_home)

    $ source .bash_profile

    credit: http://www.mkyong.com/java/maven-java_home-is-not-defined-correctly-on-mac-osx/

    0 讨论(0)
  • 2020-11-27 09:45
    % sudo port selfupdate; 
    % sudo port upgrade outdated;
    % sudo port install maven3;
    % sudo port select --set maven maven3;
    
    — add following to .zshenv -- start using zsh if you dont —
    set -a
    [[ -d /opt/local/share/java/maven3 ]] &&
        M3_HOME=/opt/local/share/java/maven3 &&
        M2_HOME=/opt/local/share/java/maven3 &&
        MAVEN_OPTS="-Xmx1024m" &&
        M2=${M2_HOME}/bin
    set +a
    
    0 讨论(0)
  • 2020-11-27 09:46

    You can use Maven Version Manager through which you can use multiple version of Maven per directory base.

    Installation

    Using Homebrew brew install mvnvm

    Without Homebrew mkdir -p ~/bin && curl -s https://bitbucket.org/mjensen/mvnvm/raw/master/mvn > ~/bin/mvn && chmod 0755 ~/bin/mvn and add ~/bin to path.

    Usage

    Default Version

    To set default maven version set the environment variable DEFAULT_MVN_VERSION to the maven version to be used by default.

    Maven version for the folder

    Create a file named mvnvm.properties in the folder and configure the maven version as follows

    mvn_version=<maven version>

    0 讨论(0)
提交回复
热议问题