1.2 Mac下配置maven环境变量
Posted lijiejoy
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了1.2 Mac下配置maven环境变量相关的知识,希望对你有一定的参考价值。
1、下载JDK
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
2、下载Maven(下载地址:https://maven.apache.org/download.cgi),解压。
SystemRequirements:
JDK Maven 3.3+ require JDK 1.7 or above to execute - they still allows you to build against 1.3 and other JDK versions by Using Toolchains
3、打开Terminal,输入以下命令,设置Maven classpath
$ vi ~/.bash_profile
4、添加下列两行代码,之后保存并退出Vi:
export M2_HOME=/Users/john/apache-maven-3.5.4 export PATH=$PATH:$M2_HOME/bin
5、输入命令以使bash_profile生效
$ source ~/.bash_profile
6、输入mvn -v查看Maven是否安装成功
192:apache-maven-3.5.4 john$ mvn -v
Apache Maven 3.5.4 (1edded0938998edf8bf061f1ceb3cfdeccf443fe; 2018-06-18T02:33:14+08:00) Maven home: /Users/john/apache-maven-3.5.4 Java version: 1.8.0_181, vendor: Oracle Corporation, runtime: /Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre Default locale: zh_CN, platform encoding: UTF-8 OS name: "mac os x", version: "10.13.6", arch: "x86_64", family: "mac"
7、IntelliJ IDEA安装Maven插件
Preferences
->Build,Execution,Deployment
->Build Tools
->Mavent
右侧配置如下图
最后点击 Apply
和Ok
按钮
以上是关于1.2 Mac下配置maven环境变量的主要内容,如果未能解决你的问题,请参考以下文章