Rodrigo Amaro Reveco
Rodrigo Amaro Reveco

Reputation: 5012

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

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. 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

Upvotes: 1

Views: 3050

Answers (1)

Mark Vieira
Mark Vieira

Reputation: 13486

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.

If you need to add your local maven repo to your build there is a special syntax for that:

repositories {
    mavenLocal()
}

Additionally, if you want to publish artifacts to your local maven repository simply apply the maven plugin and run the install task.

apply plugin: 'maven'

Upvotes: 1

Related Questions