Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle configuration to use maven local repository

Tags:

I have Maven and Gradle both installed in my system.

By default maven stores the dependency jars in the USER_HOME/.m2/repository and Gradle stores in folder USER_HOME/.gradle/caches/modules-2 respectively.

For the same project, I am end up with 2 copies of jars in my system ultimately.

Is there any configuration to set up in the gradle at global level so that it uses existing maven repository instead of its own.

Thanks in advance.

like image 573
Rajkumar Natarajan Avatar asked Nov 22 '16 03:11

Rajkumar Natarajan


People also ask

Does Gradle use Maven local repository?

Gradle can consume dependencies available in the local Maven repository. Declaring this repository is beneficial for teams that publish to the local Maven repository with one project and consume the artifacts by Gradle in another project. Gradle stores resolved dependencies in its own cache.

How do I access my local Maven repository?

Maven central repository is located on the web. It has been created by the apache maven community itself. The path of central repository is: http://repo1.maven.org/maven2/. The central repository contains a lot of common libraries that can be viewed by this url http://search.maven.org/#browse.


1 Answers

You can use

mavenLocal()

If location of repository must be in other place you can use

repositories {
    maven {
        url '/path/to/your/repository'
    }
}
like image 199
marok Avatar answered Oct 11 '22 20:10

marok