安装Android nexus,mac上搭建nexus环境给安卓搭建moven环境

AAffA0nNPuCLAAAAAElFTkSuQmCC

我们通过termial进入nexus-3.16-02,然后进入bin目录,执行

AAffA0nNPuCLAAAAAElFTkSuQmCC

然后就可以打开http://192.168.118.45:8081/,用户名和密码是admin/admin123

AAffA0nNPuCLAAAAAElFTkSuQmCC

如何上传一个aar到nexus里呢,在项目中建立一个library包,在build.gradle中加入apply from: 'mvn.gradle'

AAffA0nNPuCLAAAAAElFTkSuQmCC

然后增加mvn.gradle文件,内容是:apply plugin: 'maven'

uploadArchives {

configuration = configurations.archives

repositories {

mavenDeployer {

if (MVN_RELEASE == 'product') {

repository(url: uri(MVN_RL_URL)) {

authentication(userName: MVN_NAME, password: MVN_PASS)

}

pom.project {

version MVN_VERSION

artifactId MVN_ARTIFACT_ID

groupId MVN_GROUP_ID

packaging MVN_PACKAGING

}

} else if (MVN_RELEASE == 'snapshot') {

repository(url: uri(MVN_SN_URL)) {

authentication(userName: MVN_NAME, password: MVN_PASS)

}

pom.project {

version MVN_VERSION + "-SNAPSHOT"

artifactId MVN_ARTIFACT_ID

groupId MVN_GROUP_ID

packaging MVN_PACKAGING

}

} else if (MVN_RELEASE == 'local') {

repository(url: uri("build/aar"))

pom.project {

version MVN_VERSION

artifactId MVN_ARTIFACT_ID

groupId MVN_GROUP_ID

packaging MVN_PACKAGING

}

} else {

project.println("do nothing for task uploadArchives")

}

}

}

}

task androidSourcesJar(type: Jar) {

classifier = 'sources'

from android.sourceSets.main.java.sourceFiles

}

artifacts {

archives androidSourcesJar

}

然后在主工程的gradle.properties里加入:org.gradle.jvmargs=-Xmx1536m

# When configured, Gradle will run in incubating parallel mode.

# This option should only be used with decoupled projects. More details, visit

# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects

# org.gradle.parallel=true

MVN_ARTIFACT_ID=basemodule

MVN_GROUP_ID=com.imooc.basemodule

MVN_RL_URL=http://192.168.118.45:8081/repository/maven-releases/

MVN_SN_URL=http://192.168.118.45:8081/repository/maven-snapshots/

MVN_NAME=admin

MVN_PASS=admin123

MVN_PACKAGING=aar

MVN_RELEASE=snapshot

MVN_VERSION=1.4.8.7

然后点击

AAffA0nNPuCLAAAAAElFTkSuQmCC

就会生成jar包:

AAffA0nNPuCLAAAAAElFTkSuQmCC

如何在项目中进行使用呢:

在主工程的moven中加入:

AAffA0nNPuCLAAAAAElFTkSuQmCC

然后compile的时候使用compile 'com.nick.module:emotion:1.4.8.6-SNAPSHOT'

就行了

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值