一:搭建Nexus OSS平台目的:
为了Android-Studio,开发IDE能够快熟获取Maven中的依赖库中的构建.(如:Java中通用 .jar文件),提供一个企业内部的代码共享管理平台.
二:搭建该平台的原因:
因为公网资源下载缓慢,导致时间长,如果企业内部不搭建这种类型的平台, 那么时间成本带宽都会成倍增加.
三:搭建需要的文档和资料
maven下载地址: http://maven.apache.org/download.cgi
nexus-oss下载地址:http://www.sonatype.org/nexus/archived/
android-studio下载地址: https://developer.android.com/studio/index.html
gralde 配置资料相关资料: https://docs.gradle.org/current/userguide/init_scripts.html
整个环境运行在ubuntu14.04下. cpu, 内存, 硬盘登大家可以自己选择.
如果大家选择在上面进行打包的话,可以选择一个服务器.把环境搭建上.
四: 搭建上述第三中的所有环境资料.让android和企业开发人员体验android-studio快速构建的快感.
maven安装配置资料网址: http://maven.apache.org/install.html
安装需要确保安装了JDK1.7或以上版本.没有可以自己安装一下.并自行配置java环境变量.
我们安装软件目录都在 /home/用户主目录/soft/maven.所以下载完成的tar.gz包解压到这个目录下.
安装配置maven .
unzip apache-maven-3.3.9-bin.zip or
tar xzvf apache-maven-3.3.9-bin.tar.gz
vim /etc/profile/
在文件的最后添加上: MAVEN_HOME=/home/xxx/work/soft/maven/maven( 注:替换成自己的安装目录)
再在文件最后添加上: export PATH=$PATH:$MAVEN_HOME/bin
检查是否安装完成. export $MAVEN_HOME , source /etc/profile
mvn -v
xxx@xiuba:~/work/soft/maven$ mvn -v
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-11T00:41:47+08:00)
Maven home: /home/xiuba/work/soft/maven/maven
Java version: 1.7.0_80, vendor: Oracle Corporation
Java home: /home/xiuba/work/soft/java/jdk1.7.0_80/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "4.2.0-38-generic", arch: "amd64", family: "unix"
这样maven就安装ok了.
五:nexus --oss 安装配置.
安装配置参考资料:http://books.sonatype.com/nexus-book/reference/install.html
下载 , 下载地址http://www.sonatype.org/nexus/archived/
创建安装软件目录: mkdir /home/xxx/soft/nexus/
将下载完成的nexus拷贝到当前目录下.
sudo tar xvzf nexus-xxxxx-bundle.tar.gz
到安装目录下找到bin文件夹. 运行./nexus start.
更详细的安装资料在:http://books.sonatype.com/nexus-book/3.0/reference/install.html
输入 http://localhost:8081/nexus点击右上角login, 输入的用户名 admin , 密码: admin123 .
如果需要深入了解的,可以看看maven实战这本书.
六:接下来我们讲讲如何在android-Studio中配置我们搭建好的nexus是私服.
1. 配置网站地址.https://github.com/sonatype/nexus-book-examples
1. 给出英文参考文档地址如下: https://docs.gradle.org/current/userguide/init_scripts.html
2. 根据给出的英文文档配置如下 http://books.sonatype.com/nexus-book/reference/gradle.html
3. support-v4包编译配置参考资料: http://stackoverflow.com/questions/18380337/android-support-library-setup-with-maven
4.添加android注解支持相关参考资料: http://www.linuxidc.com/Linux/2015-08/121993.htm