在设置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