Maven Install on Mac OS X

來源:互聯網
上載者:User

標籤:maven-mac

Disclaimer: Here is a complete answer taking the last version of OS X (10.9 AKA Mavericks) into account. I am aware that everything I compiled in this answer is already present in the page, but having it clearly in one answer makes it a lot clearer.

First of all, with previous versions of OS X, Maven is installed by default. If Java is missing running [email protected]:~ $ java in a terminal will prompt you for the Java installation.

With Mac OS X 10.9 (Mavericks), Maven is not installed by default anymore. Different options are then possible:

  • Using Homebrew:

    • [email protected]:~$ brew install maven will install Maven 3.1 which might cause issues
    • [email protected]:~$ brew install maven30 will install Maven 3.0 which should be better
  • Using Macports: (I did not test this)

    • [email protected]:~$ sudo port install maven3 will Install Maven 3.0.5
    • [email protected]:~$ sudo port select –set maven maven3 selects that version of Maven
  • Installing by hand:
    • Download Maven from its homepage
    • Follow the installation instructions:
      1. Extract the distribution archive, i.e. apache-maven-3.1.1-bin.tar.gz to the directory you wish to install Maven 3.1.1. These instructions assume you chose /usr/local/apache-maven. The subdirectory apache-maven-3.1.1 will be created from the archive.
      2. In a command terminal, add the M2_HOME environment variable, e.g. export M2_HOME=/usr/local/apache-maven/apache-maven-3.1.1.
      3. Add the M2 environment variable, e.g. export M2=$M2_HOME/bin.
      4. Optional: Add the MAVEN_OPTS environment variable to specify JVM properties, e.g. export MAVEN_OPTS=”-Xms256m -Xmx512m”. This environment variable can be used to supply extra options to Maven.
      5. Add M2 environment variable to your path, e.g. export PATH=M2:PATH.
      6. Make sure that JAVA_HOME is set to the location of your JDK, e.g. export JAVA_HOME=(/usr/libexec/javahome?v1.8)andthatJAVA_HOME/bin is in your PATH environment variable (although that might not be necessary with the latest Mac OS X versions and the Oracle JDK).
      7. Run mvn –version to verify that it is correctly installed.

Maven Install on Mac OS X

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

Tags Index: