We have a project template, cleaned, without being compiled it only needs 5mb of disk space. On our Continuous Integration system, the template is being copied for each of our projects and after that, it's being changed by a script which prepares the template with the code and project properties differences of each project. Once it is prepared, it is being compiled.
All our projects have the same dependencies. And every time the template is copied and prepared to be a different project is downloading again the same dependencies. Today we experienced a very rare and dangerous problem derived from that. All of our compilations starting to fail because Gradle was not able to download a dependency:
> Could not resolve com.github.mobfox:MobFox-Android-SDK-Core:3.2.4.
> Could not get resource 'https://jitpack.io/com/github/mobfox/MobFox-Android-SDK-Core/3.2.4/MobFox-Android-SDK-Core-3.2.4.pom'.
> Could not GET 'https://jitpack.io/com/github/mobfox/MobFox-Android-SDK-Core/3.2.4/MobFox-Android-SDK-Core-3.2.4.pom'.
> Read timed out
Because of that, I need to know how can I definitively achieve that Gradle download only ONE time all the dependencies, and not every time I copy the template and prepare it for being another project. As I'm copying the template to a new folder and I rename the app and some other project things, Gradle is creating a new cache folder for it on Gradle cache directory. Is there a way to tell Gradle the exact directory route where the Gradle dependencies should be stored and searched every time the app is being compiled?