Gradle Eclipse plugin and Caching Maven Dependencies

As I understand it, while gradle can access a local maven repository to find dependencies, it does not cache them there if it needs to retrieve them from a remote repository - it caches them in its own local space.

I am trying to use the Eclipse plugin to generate a classpath file so my IDE can find the dependency information it needs, but gradle is creating classpath entries that point to my local Maven repository. Since gradle doesn’t store dependencies it has retrieved in the local Maven repo, my IDE is unable to find some of the dependencies.

Has anyone else had problems with this behavior? Any thoughts on how to work around it? Or, is it more likely that I’m just missing something or doing something wrong?

Yes, Gradle can use a Maven local repository; but it won’t write to it. So you should refrain from using mavenLocal as repository. Instead, your eclipse classpath will point to Gradle’s own “repository”, aka “Gradle cache”. You can define where Gradle will put this cache in an envrironment variable, i.e. something like this:

GRADLE_USER_HOME=/java/gradle/gradleCache

if you do not want the default which is «USER_HOME»/.gradle. See Gradle User Guide, D.4. Environment variables.

1 Like

Ah, that makes sense. Thanks!