mac 下配置maven环境( 包括android工程使用maven)
16lz
2021-01-26
1、从maven官网下载最新maven库http://maven.apache.org/download.html,我下载是apache-maven-3.2.1(如果有安裝XCode, XCode会自动帮你安裝Maven, 安裝在/usr/share/java/)
2、把下载好的文件apache-maven-3.2.1放到指定目录/Volumes/work/dev/maven下,不推荐放到系统目录
3、启动终端Terminal并 进入当前用户的home目录 输入命令cd ~
4、创建.bash_profile 输入命令touch .bash_profile
5、编辑.bash_profile文件 输入命令open -e .bash_profile .bash_profile文件添加一下内容:
export M2_HOME=/Volumes/work/dev/maven/apache-maven-3.2.1export PATH=$M2_HOME/bin:$PATH6、 保存文件,关闭.bash_profile 6. 更新刚配置的环境变量 输入命令source .bash_profile
7、验证:输入adb回车。如果未显示command not found,说明此命令有效,环境便亮设置完成
8、intellij idea已经集成maven插件,intellij配置maven环境如下图:
9、eclipse需要安装maven插件,插件地址 http://m2eclipse.sonatype.org/sites/m2e,eclipse配置maven环境如下图:
10、如果使用maven搭建android项目,还需配置android sdk路径,在settings.xml里面添加
<profiles> <profile> <id>android</id> <properties> <android.sdk.path> /Volumes/work/dev/android/android-sdk <!-- 此处为自己sdk路径 --> </android.sdk.path> </properties> </profile></profiles><activeProfiles> <!--make the profile active all the time --> <activeProfile>android</activeProfile></activeProfiles>
11、如果使用maven搭建android项目,编辑.bash_profile文件 输入命令open -e .bash_profile .bash_profile文件添加一下内容:
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home;export ANDROID_HOME=/Volumes/work/dev/android/android-sdks/tools;export ANDROID_HOME_TOOLS=/Volumes/work/dev/android/android-sdks/platform-tools;export PATH=${PATH}:${JAVA_HOME}:${ANDROID_HOME}:${ANDROID_HOME_TOOLS};
更多相关文章
- android:inputType标签、textView限制输入
- android 零星调试笔记(二)
- Android(安卓)Studio 3.0下Jni开发环境配置
- MediaCodec基本原理及使用
- Android(安卓)studio 使用 ImageView 加载 gif 文件
- Settings设置页面的Preference使用方法
- Android(安卓)Gradle文件下获取自定义properties文件,并且获取值
- 输入法显示和隐藏
- 踩坑日记-Android版本9 API28 NetworkSecurityConfig