0

I am assigned a task of building a project using gradle and maven. The project consists of a main module and its supporting modules.

The supporting modules must be uploaded to artifact local maven repository as libraries and the main module will access them from there.

How do I upload the modules? How do I convert them to libraries?

Ackman
  • 1,562
  • 6
  • 31
  • 54

1 Answers1

1

Put this in your build.gradle of library/module

apply plugin: 'maven'

artifacts {
//put library path
archives file: file('build/aar/library.aar')
}

// Define maven repository path
def localRepoPath = "file://D:/m2repo"

uploadArchives {
repositories.mavenDeployer
        {
            repository(url: localRepoPath)
             pom.artifactId = "your_artifact_id"
             pom.groupId = 'com.your.groupid'
             pom.version = android.defaultConfig.versionName

        }
}

Run gradlew uploadArchives to deploy to local maven repo.

jitinsharma
  • 1,436
  • 13
  • 22