IvyArtifactRepository

API Documentation:IvyArtifactRepository

An artifact repository which uses an Ivy format to store artifacts and meta-data.

When used to resolve metadata and artifact files, all available patterns will be searched.

When used to upload metadata and artifact files, only a single, primary pattern will be used:

  1. If a URL is specified via IvyArtifactRepository.setUrl(java.lang.Object) then that URL will be used for upload, combined with the applied IvyArtifactRepository.layout(java.lang.String).
  2. If no URL has been specified but additional patterns have been added via IvyArtifactRepository.artifactPattern(java.lang.String) or IvyArtifactRepository.ivyPattern(java.lang.String), then the first defined pattern will be used.

Repositories of this type are created by the RepositoryHandler.ivy(org.gradle.api.Action) group of methods.

Properties

PropertyDescription
authentication

The authentication schemes for this repository.

credentials

The credentials of the specified type used to authenticate with this repository.

name

The name for this repository. A name must be unique amongst a repository set. A default name is provided for the repository if none is provided.

resolve

The meta-data provider used when resolving artifacts from this repository. The provider is responsible for locating and interpreting the meta-data for the modules and artifacts contained in this repository. Using this provider, you can fine tune how this resolution happens.

url

The base URL of this repository.

Methods

MethodDescription
artifactPattern(pattern)

Adds an independent pattern that will be used to locate artifact files in this repository. This pattern will be used to locate ivy files as well, unless a specific ivy pattern is supplied via IvyArtifactRepository.ivyPattern(java.lang.String). If this pattern is not a fully-qualified URL, it will be interpreted as a file relative to the project directory. It is not interpreted relative the URL specified in IvyArtifactRepository.setUrl(java.lang.Object). Patterns added in this way will be in addition to any layout-based patterns added via IvyArtifactRepository.setUrl(java.lang.Object).

authentication(action)

Configures the authentication schemes for this repository.

credentials(credentialsType, action)

Configures the credentials for this repository using the supplied action.

credentials(action)

Configures the username and password credentials for this repository using the supplied action.

ivyPattern(pattern)

Adds an independent pattern that will be used to locate ivy files in this repository. If this pattern is not a fully-qualified URL, it will be interpreted as a file relative to the project directory. It is not interpreted relative the URL specified in IvyArtifactRepository.setUrl(java.lang.Object). Patterns added in this way will be in addition to any layout-based patterns added via IvyArtifactRepository.setUrl(java.lang.Object).

layout(layoutName)

Specifies how the items of the repository are organized.

layout(layoutName, config)
Deprecated

Specifies how the items of the repository are organized. See IvyArtifactRepository.layout(java.lang.String, org.gradle.api.Action)

layout(layoutName, config)
Deprecated

Specifies how the items of the repository are organized.

metadataSources(configureAction)
Incubating

Configures the metadata sources for this repository. This method will replace any previously configured sources of metadata.

patternLayout(config)
Incubating

Specifies how the items of the repository are organized.

Script blocks

No script blocks

Property details

AuthenticationContainer authentication (read-only)

The authentication schemes for this repository.

T credentials (read-only)

The credentials of the specified type used to authenticate with this repository.

If no credentials have been assigned to this repository, an empty set of credentials of the specified type is assigned to this repository and returned.

String name

The name for this repository. A name must be unique amongst a repository set. A default name is provided for the repository if none is provided.

The name is used in logging output and error reporting to point to information related to this repository.

The meta-data provider used when resolving artifacts from this repository. The provider is responsible for locating and interpreting the meta-data for the modules and artifacts contained in this repository. Using this provider, you can fine tune how this resolution happens.

URI url

The base URL of this repository.

Method details

void artifactPattern(String pattern)

Adds an independent pattern that will be used to locate artifact files in this repository. This pattern will be used to locate ivy files as well, unless a specific ivy pattern is supplied via IvyArtifactRepository.ivyPattern(java.lang.String). If this pattern is not a fully-qualified URL, it will be interpreted as a file relative to the project directory. It is not interpreted relative the URL specified in IvyArtifactRepository.setUrl(java.lang.Object). Patterns added in this way will be in addition to any layout-based patterns added via IvyArtifactRepository.setUrl(java.lang.Object).

void authentication(Action<? super AuthenticationContainer> action)

Configures the authentication schemes for this repository.

This method executes the given action against the AuthenticationContainer for this project. The AuthenticationContainer is passed to the closure as the closure's delegate.

If no authentication schemes have been assigned to this repository, a default set of authentication schemes are used based on the repository's transport scheme.

repositories {
    maven {
        url "${url}"
        authentication {
            basic(BasicAuthentication)
        }
    }
}

Supported authentication scheme types extend Authentication.

void credentials(Class<T> credentialsType, Action<? super T> action)

Configures the credentials for this repository using the supplied action.

If no credentials have been assigned to this repository, an empty set of credentials of the specified type will be assigned to this repository and given to the configuration action. If credentials have already been specified for this repository, they will be passed to the given configuration action.

repositories {
    maven {
        url "${url}"
        credentials(AwsCredentials) {
            accessKey "myAccessKey"
            secretKey "mySecret"
        }
    }
}

The following credential types are currently supported for the credentialsType argument:

void credentials(Action<? super PasswordCredentials> action)

Configures the username and password credentials for this repository using the supplied action.

If no credentials have been assigned to this repository, an empty set of username and password credentials is assigned to this repository and passed to the action.

repositories {
    maven {
        url "${url}"
        credentials {
            username = 'joe'
            password = 'secret'
        }
    }
}

void ivyPattern(String pattern)

Adds an independent pattern that will be used to locate ivy files in this repository. If this pattern is not a fully-qualified URL, it will be interpreted as a file relative to the project directory. It is not interpreted relative the URL specified in IvyArtifactRepository.setUrl(java.lang.Object). Patterns added in this way will be in addition to any layout-based patterns added via IvyArtifactRepository.setUrl(java.lang.Object).

void layout(String layoutName)

Specifies how the items of the repository are organized.

Recognised values are as follows:

'gradle'

A Repository Layout that applies the following patterns:

  • Artifacts: $baseUri/[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier])(.[ext])
  • Ivy: $baseUri/[organisation]/[module]/[revision]/ivy-[revision].xml
'maven'

A Repository Layout that applies the following patterns:

  • Artifacts: $baseUri/[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier])(.[ext])
  • Ivy: $baseUri/[organisation]/[module]/[revision]/ivy-[revision].xml

Following the Maven convention, the 'organisation' value is further processed by replacing '.' with '/'.

'ivy'

A Repository Layout that applies the following patterns:

  • Artifacts: $baseUri/[organisation]/[module]/[revision]/[type]s/[artifact](.[ext])
  • Ivy: $baseUri/[organisation]/[module]/[revision]/[type]s/[artifact](.[ext])

void layout(String layoutName, Closure config)

Note: This method is deprecated and will be removed in the next major version of Gradle.

Specifies how the items of the repository are organized. See IvyArtifactRepository.layout(java.lang.String, org.gradle.api.Action)

void layout(String layoutName, Action<? extends RepositoryLayout> config)

Note: This method is deprecated and will be removed in the next major version of Gradle.

Specifies how the items of the repository are organized.

The layout is configured with the supplied closure.

Recognised values are as follows:

'gradle'

A Repository Layout that applies the following patterns:

  • Artifacts: $baseUri/[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier])(.[ext])
  • Ivy: $baseUri/[organisation]/[module]/[revision]/ivy-[revision].xml
'maven'

A Repository Layout that applies the following patterns:

  • Artifacts: $baseUri/[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier])(.[ext])
  • Ivy: $baseUri/[organisation]/[module]/[revision]/ivy-[revision].xml

Following the Maven convention, the 'organisation' value is further processed by replacing '.' with '/'.

'ivy'

A Repository Layout that applies the following patterns:

  • Artifacts: $baseUri/[organisation]/[module]/[revision]/[type]s/[artifact](.[ext])
  • Ivy: $baseUri/[organisation]/[module]/[revision]/[type]s/[artifact](.[ext])

Note: this pattern is currently Incubating.

'pattern'

A repository layout that allows custom patterns to be defined. eg:

repositories {
    ivy {
        layout 'pattern' , {
            artifact '[module]/[revision]/[artifact](.[ext])'
            ivy '[module]/[revision]/ivy.xml'
        }
    }
}

The available pattern tokens are listed as part of Ivy's Main Concepts documentation.

void metadataSources(Action<? super MetadataSources> configureAction)

Note: This method is incubating and may change in a future version of Gradle.

Configures the metadata sources for this repository. This method will replace any previously configured sources of metadata.

void patternLayout(Action<? super IvyPatternRepositoryLayout> config)

Note: This method is incubating and may change in a future version of Gradle.

Specifies how the items of the repository are organized.

The layout is configured with the supplied closure.

repositories {
    ivy {
        patternLayout {
            artifact '[module]/[revision]/[artifact](.[ext])'
            ivy '[module]/[revision]/ivy.xml'
        }
    }
}

The available pattern tokens are listed as part of Ivy's Main Concepts documentation.