So. Gradle should look first to the local maven repo and then download it from the our company repo if is not stored locally.
But it fail with
What went wrong: A problem occurred configuring project ‘:app’. > Artifact ‘eu.inmite.android.lib:android-styled-dialogs:1.1.2:android-styled-dialogs.aar’ not found.
I check the folder and android-styled-dialogs/1.1.2/ exist there already. But it is downloaded only .apklib version, no .aar version. If I delete whole directory, it works correctly. It looks that gradle simply check if android-styled-dialogs/1.1.2/android-styled-dialogs-1.1.2.pom exists and doesn’t check if really exist required type of dependency.
Note that you generally don’t need to have the ‘mavelLocal()’ repo in your Gradle build file - Gradle’s default caching should work just fine. So I’d usually strongly recommend not having it in there unless you really need it.
Sometimes people use the local maven cache as a sort of local cross-project integration repository when working on related projects - it you’re doing that and need ‘mavenLocal()’ in there, then put it at the bottom, so that Gradle can pick up all your other dependencies in a more normal way and just falls back to the maven repo for the locally-built stuff.
And Yes I agree. I only use maven often too, so I have most of dependencies already downloaded, so I thought that use mavenLocal() will speed up first build.
I’m also not happy that I will have every artifact twice on my computer, but it is not possible to configure gradle to use local maven repo as it’s own cache.
Just to clarify, Gradle won’t re-download the artifacts if it finds them in your local maven repo. This happens even when you don’t include ‘mavenLocal()’ in your list of repositories.
If I omit mavenLocal(), gradle will be downloaded all dependencies from the central to it’s own local cache repository. So everything will be downloaded again. If I use mavenLocal(), gradle will check local maven repository and take the dependency from here to it’s own cache. So the only benefit is that it will be a little bit faster.
No. If you omit mavenLocal(), Gradle will not download the dependencies again. Instead, it will check in your local maven repository for an artifact with a checksum matching that on the server, and copy it instead of downloading.