将一个普通的安卓工程上传到私服。
搭建完毕后,新建一个 hosted repository,之后再配置build.gradle
apply plugin: 'com.android.library' apply plugin: 'maven'........
uploadArchives { repositories.mavenDeployer { name = 'mavenCentralReleaseDeployer' repository(url: 'http://IP:端口号/nexus/content/repositories/com.han.love/') { authentication(userName: 'admin', password: 'admin123') } pom.version = "1.0.1" pom.artifactId = "artifactId" pom.groupId = "com.han.love" pom.name = "name" pom.packaging = 'aar' } }
执行命令:gradle uploadArchives
成功!
其他工程引用:
<pre name="code" class="html" style="white-space: pre-wrap; word-wrap: break-word; font-size: 14px; line-height: 26px; background-color: rgb(255, 255, 255);">compile '<span style="font-family: Menlo;">com.han.love</span><span style="font-family: Arial, Helvetica, sans-serif;">:</span><span style="font-family: Menlo;">artifactId</span><span style="font-family: Arial, Helvetica, sans-serif;">:1.0.1@</span><span style="font-family: Arial, Helvetica, sans-serif; background-color: rgb(255, 153, 153);">aar</span><span style="font-family: Arial, Helvetica, sans-serif;">'</span>
完毕