Gradle configuration to use maven local repository

2019-05-07 11:00发布

问题:

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.

回答1:

You can use

mavenLocal()

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

repositories {
    maven {
        url '/path/to/your/repository'
    }
}


标签: gradle