gradle
8.3

# mavenCentral

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

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 are accepted as keys 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.
`artifactUrls` | A single jar repository or a collection of jar repositories containing additional artifacts not found in the Maven central repository. But be aware that the POM must exist in Maven central. The provided values are evaluated as per uri.

Examples:

    repositories {
        mavenCentral artifactUrls: ["http://www.mycompany.com/artifacts1", "http://www.mycompany.com/artifacts2"]
        mavenCentral name: "nonDefaultName", artifactUrls: ["http://www.mycompany.com/artifacts1"]
    }

Content copied to clipboard

#### Return

the added repository

#### Parameters

args

A list of urls of repositories to look for artifacts only.

abstract fun mavenCentral(): MavenArtifactRepository

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(java.util.Map)

abstract fun mavenCentral(action: Action<out Any>): MavenArtifactRepository

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

#### Parameters

action

a configuration action