Local Maven Repository and Libraries

Are you tired of waiting for a snapshot or a new version to be published? — Why not doing it yourself locally?

Francisco Riádigos
AndroidPub

--

I have rewrote this story to make it more valuable for the readers.

Local Maven Repository

If what you want is just to store your Android libraries or modules locally as a maven repository into your computer, and import the dependency directly in your project like if it were really published:

implementation 'com.example:my-library:x.y.z'

All you need to do is the following:

  • Enable mavenLocal repositories into your build system and apply any android-maven plugin to your library’s build.gradle file.
buildscript {
repositories {
mavenLocal()
}
}
plugins {
// This plugin allows publishing android libraries
id "com.github.dcendents.android-maven" version "2.0"
}
  • Also configure a mavenInstaller inside your library’s build.gradle file.
install {
repositories.mavenInstaller {
pom.groupId = 'com.example'
pom.version = 'x.y.z'
pom.artifactId = project.name
}
}

--

--

Francisco Riádigos
AndroidPub

Former @LloydsBank, @BritishAirways, @SkyUK, @Wefox, @Indra... Co-founder @Chatty