# mavenCentral

abstract fun mavenCentral(): MavenArtifactRepository(source)

Adds a repository which looks in the Maven central repository for dependencies. The URL used to access this repository is {@value org.gradle.api.artifacts.ArtifactRepositoryContainer#MAVEN_CENTRAL_URL}. The name of the repository is {@value org.gradle.api.artifacts.ArtifactRepositoryContainer#DEFAULT_MAVEN_CENTRAL_REPO_NAME}.

Examples:

    repositories {
        mavenCentral()
    }

Content copied to clipboard

#### Return

the added resolver

#### See also

mavenCentral(Action)

abstract fun mavenCentral(action: Action<in MavenArtifactRepository>): MavenArtifactRepository(source)

Adds a repository which looks in the Maven central repository for dependencies. The URL used to access this repository is {@value org.gradle.api.artifacts.ArtifactRepositoryContainer#MAVEN_CENTRAL_URL}. The name of the repository is {@value org.gradle.api.artifacts.ArtifactRepositoryContainer#DEFAULT_MAVEN_CENTRAL_REPO_NAME}.

Examples:

    repositories {
        mavenCentral()
    }

Content copied to clipboard

#### Return

the added resolver

#### Since

5.3

#### Parameters

action

a configuration action

abstract fun mavenCentral(args: Map<String, out Any>): MavenArtifactRepository(source)

### Deprecated

This method is scheduled to be removed in Gradle 10. Use mavenCentral instead.

Adds a repository which looks in the Maven central repository for dependencies. The URL used to access this repository is {@value org.gradle.api.artifacts.ArtifactRepositoryContainer#MAVEN_CENTRAL_URL}.

The following parameter is accepted as a key for the map:

`name` | (optional) The name of the repository. The default is {@value org.gradle.api.artifacts.ArtifactRepositoryContainer#DEFAULT_MAVEN_CENTRAL_REPO_NAME} is used as the name. A name must be unique amongst a repository group.

#### Return

the added repository

#### Parameters

args

Configuration map for the Maven Central repository.