如何将aar库上传到Nexus? [英] How do I upload an aar library to Nexus?

查看:637
本文介绍了如何将aar库上传到Nexus?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个与Android应用程序一起使用的Android Aar库.它可以与直接包含在Android项目中的aar库一起正常使用.我想将此库移到我的内部Nexus maven存储库中,以便其他开发人员也可以使用该库.

I have an Android aar library I am using with an Android application. It is working correctly with the aar library included directly in the Android project. I would like to move this library to my internal Nexus maven repository, so that other developers can use the library too.

如何将aar上传到Nexus(Maven存储库)? Web界面中没有明显的选择:

How do I upload the aar to Nexus (the Maven repository)? There is no apparent option to do so in the web interface:

推荐答案

我使用了 gradle的maven插件,可通过修改Android build.gradle文件将其上传到Nexus.

I used gradle's maven plugin to upload to Nexus by modifying the Android build.gradle file.

apply plugin: 'maven'

dependencies {
    deployerJars "org.apache.maven.wagon:wagon-http:2.2"
}

uploadArchives {
    repositories.mavenDeployer {
        configuration = configurations.deployerJars
        repository(url: "https://my.example.com/content/repositories/com.example/") {
            authentication(userName: "exampleUser", password: "examplePassword")
            pom.groupId = "com.example"
            pom.artifactId = "myexample"
            pom.version = '1.0.0'
        }
    }
}

要上传:gradlew upload,使用Android Studio项目提供的gradlew脚本.

To upload: gradlew upload, using the gradlew script that is provided by the Android Studio project.

您还可以将身份验证参数移动到不受版本控制的文件中.

这篇关于如何将aar库上传到Nexus?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆