Disable the use of caches and use maven local repository

Since the last couple of versions (4.2 onwards?) the gradle cache has become more problematic. All maven dependencies are downloaded into the ~/.gradle/caches folder. This has drawbacks:

  • The IDE (IntelliJ) cannot find javadoc anymore.
  • The folder structure of maven is much cleaner than gradle caches
  • Gradle will happily download already available deps in maven local
  • When using a local nexus server these deps downloaded from this server will also end up in the local caches folder.

How to disable this behaviour and use the local maven repository only to store dependencies?

Thanks in advance for any pointers how to work around this!

Bart

I don’t think there is a way to disable the dependency cache. Javadoc works fine for me; perhaps there’s a problem with your setup. Dependencies that already exist in Maven Local are copied into the Gradle cache and aren’t downloaded anew. (See https://docs.gradle.org/current/userguide/dependency_cache.html) For best results, avoid declaring mavenLocal() in Gradle, as this can slow down your build and make it less reproducible.

Thanks Fred, especially this is great advice " avoid declaring mavenLocal() in Gradle, as this can slow down your build and make it less reproducible."

I am still testing this but it seems to improve. Still I have an issue with snapshot versions which get downloaded from a Sonatype nexus server. Since this cache was introduced it downloads first the snapshot version and then tries to look for the release version in maven-snapshots and maven-publoc respectively. When I delete the gradle cache folder it doesn’t do that.