1.Java环境变量设置就不说。 但是配置Maven需要检查下Java环境变量的设置。需要检查JAVA_HOME环境变量以及Java命令
wanyakundeMacBook-Pro:Library wanyakun$ echo $JAVA_HOME /Library/Java/JavaVirtualMachines/jdk1.7.0_60.jdk/Contents/Home wanyakundeMacBook-Pro:Library wanyakun$ java -version java version "1.7.0_60-ea" Java(TM) SE Runtime Environment (build 1.7.0_60-ea-b15) Java HotSpot(TM) 64-Bit Server VM (build 24.60-b09, mixed mode) wanyakundeMacBook-Pro:Library wanyakun$
2.接着到http://maven.apache.org/download.html下载Maven安装文件,如apache-maven-3.2.3-bin.tar.gz,然后解压到本地目录
接下来,我们需要设置M2_HOME(IntelliJ默认为M2_HOME)环境变量指向apache-maven-3.2.3,并且把Maven安装目录下的bin/文件夹添加到系统环境变量PATH中去:
vim打开/etc/profile文件 加入如下代码:
export M2_HOME=/Users/wanyakun/Documents/apache-maven-3.2.3
export PATH=$PATH:$M2_HOME/bin
至此,安装完成,我们可以运行以下命令检查Maven安装:
echo $M2_HOME
mvn –version
wanyakundeMacBook-Pro:~ wanyakun$ echo $M2_HOME /Users/wanyakun/Documents/apache-maven-3.2.3 wanyakundeMacBook-Pro:~ wanyakun$ mvn -version Apache Maven 3.2.3 (33f8c3e1027c3ddde99d3cdebad2656a31e8fdf4; 2014-08-12T04:58:10+08:00) Maven home: /Users/wanyakun/Documents/apache-maven-3.2.3 Java version: 1.7.0_60-ea, vendor: Oracle Corporation Java home: /Library/Java/JavaVirtualMachines/jdk1.7.0_60.jdk/Contents/Home/jre Default locale: zh_CN, platform encoding: UTF-8 OS name: "mac os x", version: "10.10.1", arch: "x86_64", family: "mac" wanyakundeMacBook-Pro:~ wanyakun$
时间: 2024-10-20 11:49:38