我有一个 Android aar 库,正在与 Android 应用程序一起使用。它可以与直接包含在 Android 项目中的 aar 库一起正常工作。我想将此库移至我的内部 Nexus maven 存储库,以便其他开发人员也可以使用该库。
如何将 aar 上传到 Nexus(Maven 存储库)? Web 界面中没有明显的选项可以执行此操作:
对于 Android,我们通常有两个 build.gradle 文件,一个位于顶层文件夹,另一个位于特定模块中:
app/
---build.gradle
---module/
------build.gradle
In the 应用程序/build.gradle您必须添加该库的客户端文件:
repositories {
jcenter()
maven {
url "http://localhost:8081/repository/test-maven-repo/"
}
}
为您图书馆应用程序/模块/build.gradle file:
apply plugin: 'maven'
uploadArchives {
repositories {
mavenDeployer {
repository(url: "http://localhost:8081/repository/test-maven-repo/") {
authentication(userName: "admin", password: "admin123")
pom.groupId = "com.example.test"
pom.artifactId = "myexample.test"
pom.version = '1.0.0'
}
}
}
}
您可能只想运行它:
./gradlew upload
官方文档链接:Maven 发布插件 https://docs.gradle.org/current/userguide/publishing_maven.html.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)