# mavenLocal

abstract fun mavenLocal(): MavenArtifactRepository

Adds a repository which looks in the local Maven cache for dependencies. The name of the repository is {@value org.gradle.api.artifacts.ArtifactRepositoryContainer#DEFAULT_MAVEN_LOCAL_REPO_NAME}.

Examples:

    repositories {
        mavenLocal()
    }

Content copied to clipboard

The location for the repository is determined as follows (in order of precedence):

1. The value of system property 'maven.repo.local' if set;
2. The value of element of `~/.m2/settings.xml` if this file exists and element is set;
3. The value of element of `$M2_HOME/conf/settings.xml` (where `$M2_HOME` is the value of the environment variable with that name) if this file exists and element is set;
4. The path `~/.m2/repository`.

#### Return

the added resolver

abstract fun mavenLocal(action: Action<in MavenArtifactRepository>): MavenArtifactRepository

Adds a repository which looks in the local Maven cache for dependencies. The name of the repository is {@value org.gradle.api.artifacts.ArtifactRepositoryContainer#DEFAULT_MAVEN_LOCAL_REPO_NAME}.

Examples:

    repositories {
        mavenLocal()
    }

Content copied to clipboard

The location for the repository is determined as follows (in order of precedence):

1. The value of system property 'maven.repo.local' if set;
2. The value of element of `~/.m2/settings.xml` if this file exists and element is set;
3. The value of element of `$M2_HOME/conf/settings.xml` (where `$M2_HOME` is the value of the environment variable with that name) if this file exists and element is set;
4. The path `~/.m2/repository`.

#### Return

the added resolver

#### Since

5.3

#### Parameters

action

a configuration action