How to use Maven Local repository for gradle build

(kavinks) #1

I need to reuse the maven local repository for dependencies. I have used the below configuration. But it seems to be not working.

repositories {
 mavenCentral artifactUrls:["file://C:/maven/.m2/repository/"]

Please advise.

(Luke Daley) #2

There’s a special notation.

repositories {

(kavinks) #3

Thanks Luke. Its working Fine.

(Jon Austen) #4

Also, can’t you do this by setting the project to run in offline mode?

(Florian Schmaus) #5

What is if I’ve configured mavenLocal() and 'maven { url ‘’ } and there exists snapshot in the maven snapshot repository and in my local maven cache? Which snapshot will be used, ie. considered newer?

(Mark Vieira) #6

Gradle searches for dependencies in repositories in the order in which they are listed. So if you want to find snapshots in your local maven repo first, ensure that ‘mavenLocal()’ is listed first in your ‘repositories’ configuration.

See the Gradle documentation for more information.

(Fernando Federico) #7

If I’m using a snapshot I would like to get the latest version no matter if it is in my local repo or a remote one. Is that posible?

(Beniamin Czaplicki) #8

Thanks :slight_smile: