I am working on an Android SDK made of multiple library modules and a test app module:


I would like to publish it on a Maven repository, with all library modules embedded (but not the test-app).

I know how to publish a single library module using Maven Publish Plugin but can't figure out how to make a Maven publication containing multiple library modules.

How would you do that ?


Just upload each module as a standalone module.
It is not mandatory to upload all the modules at the same time, the dependencies are just described in the pom file.

It can be useful putting a base script in a single gradle file with some common settings and properties (you can read them from a gradle.properties file), something like:


apply plugin: 'maven'

      pom.artifactId = POM_ARTIFACT_ID

      pom.project {
           name POM_NAME
           packaging POM_PACKAGING
           description POM_DESCRIPTION
           url POM_URL


and then in each module/build.gradle file add:

apply from: '../maven_push.gradle'
  • 1
Reply Report

Each module is a library by itself, so configure each one of them (besides the app) to be packaged as AAR files and deployed to the desired repo. If you are going to use the Maven publish plugin, just apply the steps to each module(to the module's build.gradle files). A good practice is to centralize the groupId and version values, perhaps in the gradle.properties file, or in the main gradle file. Same procedure applies to other plugins, like the android-gradle-maven plugin.

  • 0
Reply Report

Warm tip !!!

This article is reproduced from Stack Exchange / Stack Overflow, please click

Trending Tags

Related Questions