1. 程式人生 > >android gradle 上傳module aar 至nexus

android gradle 上傳module aar 至nexus

前言

這裡主要介紹一個android studio怎麼使用gradle把自已寫的一些module以aar包的方式上傳到公司內部的nexus私服中。這樣就即可以方便的進行程式碼複用,也可以保證程式碼的安全性,這樣在使用時,就可以分出一個人來單獨維護這個module.

詳細配置

以下是gradle的詳細配置,相對來說還是比較簡單的。有點基礎的應該都能看懂,這裡就不詳細介紹了。

// 在gradle的第一行加
apply plugin: 'maven'


uploadArchives {
    repositories {
        mavenDeployer {

            repository(url: "http://mynexus.com:8081/nexus/content/repositories/android"
) { authentication(userName: "admin", password: "admin123") } pom.version = "1.0.0" pom.artifactId = "tools" pom.groupId = "com.android.library" pom.name = "tools" pom.packaging = 'aar' } } }