Published on

Using a local Maven repository for Gradle

Authors

If you work on a project that uses any private Gradle/Maven libraries then you have probably been in the situation where you need to make changes to a library and use it in another app but you don't want to have to publish the library, test the updates worked correctly only to find often that there are still other changes you need.

A colleague showed me a nice little trick for dealing with this scenario, use your local Maven repository. To do this, in the library you wan to test:

  1. Make your changes
  2. Bump the version up
  3. Then run:
./gradlew build publishToMavenLocal

On the project you want to consume it add the following to the very bottom of your repositories section:

repositories {
    //...

    mavenLocal()
}