
When you have a single Gradle project it is usually set up with a rootProject and a single sub-project. In this blog post I will discuss a method of greatly reducing the amount of Gradle code required in multi-project builds. However, this involves quite some extra build logic which also needs to be maintained. One method of optimizing build times is by splitting your build up into multiple modules (or in gradle terminology, sub-projects). I’ll make an attempt to update it at some point I would recommend looking into concepts like convention plugins instead of following the recommendations in this articleīuild time is one of the biggest perils of any Android developer. aar extension, and you don’t put the suffix on the dependency, then gradle might try to download the lib from the internet instead from mavenLocal (.m2 folder).Reducing boilerplate in Gradle multi-module projectsĮdit 2022–06–17: This post was published in 2018 and, in my personal opinion, didn’t age very well.

If you have published you lib artifact locally with. Depending on how is the publication of the artifact of your library you may need to add the extension in the dependencies block.

It’s a common mistake to forget to update the version on the dependencies block as well. If you upgrade your library version, for instance, to v1.1 while you do your fix, make sure you use the same version on the dependencies block of your project. Make sure you are using the correct version of your library.

Make sure mavenLocal() is in the first position of the list.Add mavenLocal() as a repository location in the main adle.

In the project where you are integrating the Library: The publishToMavenLocal is a built-in task of the maven-publish plugin of Gradle, and it will not publish anything into the remote Artifactory (JCenter / Maven) at all. Once finished, all *.pom and *.aar files will be located in your local /. Let’s assume you have access to the code of that Library, then just download it into your computer, navigate by a terminal console to the root path and execute the following commands to publish locally the Maven files. If you are integrating a Library in your Project that has a bug that must be fixed or you want just make some changes on it, but you can’t wait for a Snapshot to be released in order to test it, you can publish it locally and reflect any changes by following these steps.
