Why do you need to include mavenLocal()? (This has no performance benefit and will actually be slowing things down.) ‘mavenLocal’ is only required if you are producing binaries locally with Maven and then using then in a Gradle build.
Does gradle not work with maven projects (mixing of local repositories for 3rd party libs)?
Yes it should. You definitely shouldn’t need to delete your local M2 repository! Can you put it back, and confirm that you are getting “Artifact ‘foo’ not found.” errors?
In that case, please provide the full output of running gradle with the ‘–debug’ flag. The best way to provide this is via GitHub Gist.
Instead of using the Maven cache to share artifacts between your Gradle builds, I would suggest that you use a separate maven repository, and publish the artifacts using ‘gradle uploadArchives’.
I already use the uploadArchives to deploy to artifactory. It seems a bit overkill to upload an artifact A to artifactory to be able to use it as a dependency in project B locally.
Further others might be using A from artifactory and I don’t want to break their version by uploading something that I am experimenting with locally (as I see it deploy to artifactory should only be done by the integration server).
OK. There is no built-in Gradle equivalent of ‘maven install’ to publish an artifact to a local repository only. Gradle doesn’t automatically differentiate between different repositories, and you never “install” into the Gradle Cache. (In Maven, the cache and local repository are one-and-the-same).
You could easily script something up by detecting a project property to choose which repository to ‘uploadArchives’ to:
Use ‘gradle -PlocalInstall uploadArchives’ to only install the artifact locally. Use ‘gradle uploadArchives’ to upload to artifactory. (Or switch the flag so that local is the default).
In your consuming build, if you place the local repository first in your list of repositories, locally installed artifacts will be used in preference to those in artifactory.
Use a shared local (filesystem) repository. You can decide where you want this to go.
In general I’d avoid using the Maven cache/repository except for sharing between Maven and Gradle builds. But if that’s really what you want to do, then it should work: we’ll need to see the debug logs of your failed build to work out why it’s not working.