Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle downloading dependency into cache instead of maven repository

I am trying to maintain the same repository on my filesystem for maven and gradle. But I am running into some problems.

I have the following in my build.gradle file.

repositories {
    mavenLocal()
    mavenCentral()
}

dependencies {
    compile group: 'org.codehaus.groovy', name: 'groovy-all', version: '2.3.9'
    runtime group: 'org.codehaus.groovy', name: 'groovy-all', version: '2.3.9'
    runtime 'org.xerial:sqlite-jdbc:3.8.7'
}

GRADLE_HOME is D:\Programming\Java\gradle-2.2.1
GRADLE_USER_HOME is D:\Programming\Java\.m2

My gradle home is the same as my Maven repository.

But when the dependencies are downloaded via gradle they are being downloaded into the GRADLE_USER_HOME\cache instead of the repository folder. What configuration am I missing?

EDIT I have checked the chapter on dependency management of the book Gradle In Action. Nothing. I have checked the dependency management on gradle's website but it also just says that cache is used.

It seems that there is no such option available in gradle. Can someone confirm?

like image 999
Aseem Bansal Avatar asked Jan 03 '15 06:01

Aseem Bansal


People also ask

Does Gradle use Maven cache?

Gradle will use its own internal cache for all resolved dependencies, including ones coming from the local maven repository. For example, if you use a dependency org:foo:1.0 from your maven local repository, the metadata and artifact will be copied to the Gradle cache on first resolution.

Does Gradle use Maven repository?

Bookmark this question. Show activity on this post.

What is dependency cache in Gradle?

The Gradle dependency cache consists of two storage types located under GRADLE_USER_HOME/caches : A file-based store of downloaded artifacts, including binaries like jars as well as raw downloaded meta-data like POM files and Ivy files.


1 Answers

There is no setting to change that. There is no gradle repository as such. Also, it seems like a bad idea to have gradle use the repository's folder as dependency cache because of the clutter.

If you are trying to publish artifacts built by gradle to said maven repository, you should probably take a look at the maven-publish plugin.

If you are trying to use artifacts from that repository in your build, the way to go would be to add mavenLocal() to your repositories and then just use the compile function in your dependencies.

like image 76
Insomniac Avatar answered Oct 23 '22 17:10

Insomniac