简体   繁体   English

将AAR库上传到本地Maven存储库并在git中共享build.gradle

[英]Upload AAR library to local maven repository and share build.gradle in git

I'm trying to use a local repository to compile a library with resources, so I added this lines to mi build.gradle 我正在尝试使用本地存储库来编译具有资源的库,因此我在mi build.gradle中添加了以下行

def MAVEN_LOCAL_PATH = 'file:///Users/XXXX/.m2/repository'
def VERSION_NAME = '0.1.0-SNAPSHOT'
def GROUP_ID = 'XXXX'
def ARTIFACT_ID = 'XXXX'

def coreAarFile = file('build/CoreLib.aar')
artifacts {
    archives coreAarFile
}
uploadArchives {
    repositories {
        mavenDeployer {
            repository(url: MAVEN_LOCAL_PATH)
            pom.groupId = GROUP_ID
            pom.artifactId = ARTIFACT_ID
            pom.version = VERSION_NAME
        }
    }
}

This works, but now I'm working with a team, so I need to upload to the git repository this changes on the build.gradle file, but the var MAVEN_LOCAL_PATH has my own local repository path. 这可行,但是现在我正在与一个团队一起工作,因此我需要将build.gradle文件上的更改上传到git存储库,但是var MAVEN_LOCAL_PATH具有我自己的本地存储库路径。 How can I work with this? 我该如何处理? I need the local repository because our maven server is just a git repo in some place in bitbucket, we only need to copy/paste the folder from the maven local repository to the local git clone of the maven server 我需要本地存储库,因为我们的maven服务器只是bitbucket中某个位置的git存储库,我们只需要将文件夹从maven本地存储库复制/粘贴到maven服务器的本地git克隆中

I'm not sure I understand how your local maven repo is supposed to interact with the git repository but this may help you out. 我不确定我是否理解本地Maven存储库应该如何与git存储库进行交互,但这可能会对您有所帮助。

If you need to add your local maven repo to your build there is a special syntax for that: 如果您需要将本地Maven存储库添加到构建中,则有一种特殊的语法:

repositories {
    mavenLocal()
}

Additionally, if you want to publish artifacts to your local maven repository simply apply the maven plugin and run the install task. 此外,如果要将工件发布到本地Maven存储库,只需应用maven插件并运行install任务。

apply plugin: 'maven'

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法使用gradle build dystem将生成的.aar文件上传到android studio中的本地Maven存储库 - Not able to upload the generated .aar file to local maven repository in android studio with gradle build dystem 将 Maven 存储库添加到 build.gradle - add maven repository to build.gradle 如何在我的Maven本地存储库中发布带有gradle的现有aar? - How to publish in my maven local repository an existing aar with gradle? 如果依赖项在aar库中声明,我是否需要在应用程序的build.gradle中对同一库进行delcare? - if the dependencies were declared in the aar library, do I need to delcare the same library in the build.gradle of the application? build.gradle存储库合并 - build.gradle repository merge 在.aar文件中添加gradle依赖项(build.gradle) Android - Add gradle dependencies(build.gradle) in .aar file Android 构建被配置为更喜欢设置存储库而不是项目存储库,但是构建文件“build.gradle”添加了存储库“maven” - Build was configured to prefer settings repositories over project repositories but repository 'maven' was added by build file 'build.gradle' Android - Gradle - 将 build.gradle 存储库中的相对路径添加到本地目录 - Android - Gradle - Adding relative path in build.gradle repository to local directory 如何使用build.gradle创建AAR文件 - How can I create aar file using build.gradle Gradle:基于apps build.gradle flavor在本地库上使用setIgnore。 - Gradle: Using setIgnore on a local library based on the apps build.gradle flavor.
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM