mavenLocal() - how does Gradle resolve the directory of the local maven repository?

Gradle guides often declare the local maven repository like this:

repositories {
   mavenLocal()
}

For me, this does not work, even if have set environment variables M2_HOME or MAVEN_HOME pointing to my maven installation directory. I think the point is: the root directory of my local maven repository is somewhere else, defined in settings.xml of maven/conf. And it seems that Gradle is not evaluating this settings.xml.

So for me the only solution is define the path to the repository like this:

maven {
         url uri('D:/Java/mvn-repo')
      }

Is this true? Or can I define my maven repository root directory in some global settings definition?

Gradle looks into ‘~/.m2/settings.xml’ for information where the local Maven repository is located. If no information is found, it assumes ‘~/.m2/repository’. By the way, it’s enough to say ‘maven { url ‘D:/Java/mvn-repo’ }’.

I’m using gradle 1.8 on redhat 6.4 and it’s defaulting to “/home/me” when there is no settings.xml. Normall that would be fine but ~ = /export/home/me and I’m expessly setting it: repositories {

mavenLocal() }

uploadArchives {

repositories {

mavenDeployer {

repository(url: “file://export/home/me/.m2/repository”)

}

} }