mvn命令指定java home_指定Maven的环境变量M2_HOME,

在设置Apache Stratos的开发环境的时候,被java版本的切换坑了很久,后面是能用export JAVA_HOME="$(/usr/libexec/java_home -v 1.7)"这个命令手动在zsh下切换。

下面是设置Apache Stratos时,一些环境变量的设置要求。

Setting up Apache Stratos source

Download and install JDK 1.6 on your computer.

Create the JAVA_HOME environment variable, and point it to .

 refers to the installation directory of JDK.

Download and install Apache Maven (3.0.0 or later) on your computer.

Create the M2_HOME environment variable, and point to .

 refers to the installation directory of Apache Maven.

Set the MAVEN_OPTSenvironment variable as follows:

MAVEN_OPTS="-Xms512m -Xmx1536m -XX:MaxPermSize=512m -XX:ReservedCodeCacheSize=256m"

Install a preferred Java IDE, and make sure Maven support is available.

Checkout Apache Stratos source code from its Git repository as follows:

Select the Apache Stratos source code of the required release version, from the master branch of the Git repository.

Set the STRATOS_SOURCE environment variable, and point it to .

 refers to the directory created by the Git clone in the previous step, which includes Apache Stratos source code.

设置M2_HOME

1.在用户目录~下运行

vim .bash_profile 命令

2. 打开.bash_profile文件之后,在其最后加入下面的内容,不包括括号中的解释的内容以及括号。

export M2_HOME=/usr/local/Cellar/maven/3.3.3/libexec  (这里的maven的安装路径可以运行命令  mvn -v 得到)

3.运行下面的命令使其生效

source ~/.bash_profile

4.检查

此时,运行

echo $M2_HOME

应该会回显出  /usr/local/Cellar/maven/3.3.3/libexec    ,证明设置成功

注意:

若在zsh中新开了一个窗口,而运行

echo $M2_HOME

会发现回现一个空行,

此时,再运行一遍

source ~/.bash_profile

就好了

配置MAVEN_OPT和STRATOS_SOURCE的方法和配置M2_HOME的方法是一样的,注意source下~/.bash_profile

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值