MAC 安装 JDK Maven配置环境变量

1:启动mac终端输入vim~ / .bash_profile
输入i进行编辑
export JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home"
(路径到Java的Home这里)
export PATH=“ J A V A H O M E / b i n : JAVA_HOME/bin: PATH”
export M2_HOME="/Library/maven3"
(Maven解压包路径)
export PATH=“ M 2 H O M E / b i n : M2_HOME/bin: PATH”
export MYSQL2="/usr/local/mysql"
export PATH=“ M Y S Q L 2 / b i n : MYSQL2/bin: PATH”
在这里插入图片描述

按esc输入 :wq (冒号加wq进行保存退出操作);
然后在终端输入:source 〜/ .bash_profile更新配置文件操作

在maven的settings.xml里面指定全局jdk编译版本

<profiles>
    <profile>  
      <id>jdk-1.8</id>  
      <activation>  
          <activeByDefault>true</activeByDefault>  
          <jdk>1.8</jdk>  
      </activation>  
      <properties>  
          <maven.compiler.source>1.8</maven.compiler.source>  
          <maven.compiler.target>1.8</maven.compiler.target>  
          <maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>  
      </properties>   
   </profile>
</profiles>

猜你喜欢

转载自blog.csdn.net/WSFLOVE/article/details/88868833