# 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()` then that URL will be used for upload, combined with the applied `IvyArtifactRepository.layout()`.
2. If no URL has been specified but additional patterns have been added via `IvyArtifactRepository.artifactPattern()` or `IvyArtifactRepository.ivyPattern()`, then the first defined pattern will be used.

### Properties

Property | Description
`resolve` | Incubating 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.

### Property details

#### `IvyArtifactRepositoryMetaDataProvider` `resolve` (read-only)

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

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.

### Script blocks

No script blocks

### Methods

Method | Description
`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()`. 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 the URL specified in `IvyArtifactRepository.setUrl()`. Patterns added in this way will be in addition to any layout-based patterns added via `IvyArtifactRepository.setUrl()`.
`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 the URL specified in `IvyArtifactRepository.setUrl()`. Patterns added in this way will be in addition to any layout-based patterns added via `IvyArtifactRepository.setUrl()`.
`layout(layoutName)` | Specifies the layout to use with this repository, based on the root url. See `IvyArtifactRepository.layout()`.
`layout(layoutName, config)` | Specifies the layout to use with this repository, based on the root url. The returned layout is configured with the supplied closure. Available layouts are outlined below.

### 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()`. 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 the URL specified in `IvyArtifactRepository.setUrl()`. Patterns added in this way will be in addition to any layout-based patterns added via `IvyArtifactRepository.setUrl()`.

#### `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 the URL specified in `IvyArtifactRepository.setUrl()`. Patterns added in this way will be in addition to any layout-based patterns added via `IvyArtifactRepository.setUrl()`.

#### `void` `layout`(`String` layoutName)

Specifies the layout to use with this repository, based on the root url. See `IvyArtifactRepository.layout()`.

#### `void` `layout`(`String` layoutName, `Closure` config)

Specifies the layout to use with this repository, based on the root url. The returned layout is configured with the supplied closure. Available layouts are outlined below.

##### '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 '/'.

##### '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'
            }
        }
    }