简体   繁体   English

如何在Macos上安装和配置Maven

[英]How to install and configure Maven on Macos

我正在搜索在Mac OS上安装和配置Maven的最佳方法吗?

There are two methods: 有两种方法:

With brew installation: 使用brew安装:

Without installing brew: 不安装brew:

  • Download the Maven, for example apache-maven-3.1.1-bin.tar.gz. 下载Maven,例如apache-maven-3.1.1-bin.tar.gz。 Extracts it, tar -xvf apache-maven-3.1.1-bin.tar.gz 提取tar -xvf apache-maven-3.1.1-bin.tar.gz

  • Set Maven command in environment variable: Update ~/. 在环境变量中设置Maven命令:更新〜/。 bash_profile – create this file if doesn't exist. bash_profile –创建该文件(如果不存在)。

    ~/.bash_profile export M2_HOME=/Users/youusername/apache-maven-3.1.1 export PATH=$PATH:$M2_HOME/bin 〜/ .bash_profile export M2_HOME = /用户/youusername/apache-maven-3.1.1 export PATH = $ PATH:$ M2_HOME / bin

  • Finally restart the terminal. 最后重启终端。 Test it using: mvn -version 使用以下命令对其进行测试:mvn -version

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM