Package org.gradle.api.artifacts.repositories

## Interface IvyArtifactRepository

- All Superinterfaces:
    `ArtifactRepository`, `AuthenticationSupported`, `MetadataSupplierAware`, `UrlArtifactRepository`

      public interface IvyArtifactRepository
      extends ArtifactRepository, UrlArtifactRepository, AuthenticationSupported, MetadataSupplierAware

  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 `setUrl(Object)` then that URL will be used for upload, combined with the applied `layout(String)`.
  2. If no URL has been specified but additional patterns have been added via `artifactPattern(java.lang.String)` or `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.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Interface | Description
    --- | --- | ---
    `static interface` | `IvyArtifactRepository.MetadataSources` | Allows configuring the sources of metadata for a specific repository.

  - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static String` | `GRADLE_ARTIFACT_PATTERN` |
    `static String` | `GRADLE_IVY_PATTERN` |
    `static String` | `IVY_ARTIFACT_PATTERN` |
    `static String` | `MAVEN_ARTIFACT_PATTERN` |
    `static String` | `MAVEN_IVY_PATTERN` |

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Deprecated Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `artifactPattern​(String pattern)` | Adds an independent pattern that will be used to locate artifact files in this repository.
    `IvyArtifactRepository.MetadataSources` | `getMetadataSources()` | Returns the current metadata sources configuration for the repository.
    `IvyArtifactRepositoryMetaDataProvider` | `getResolve()` | Returns the meta-data provider used when resolving artifacts from this repository.
    `URI` | `getUrl()` | The base URL of this repository.
    `void` | `ivyPattern​(String pattern)` | Adds an independent pattern that will be used to locate ivy files in this repository.
    `void` | `layout​(String layoutName)` | Specifies how the items of the repository are organized.
    `void` | `layout​(String layoutName, Closure config)` | Deprecated. use `layout(String)` or `patternLayout(Action)`
    `void` | `layout​(String layoutName, Action<? extends RepositoryLayout> config)` | Deprecated. use `layout(String)` or `patternLayout(Action)`
    `void` | `metadataSources​(Action<? super IvyArtifactRepository.MetadataSources> configureAction)` | Configures the metadata sources for this repository.
    `void` | `patternLayout​(Action<? super IvyPatternRepositoryLayout> config)` | Specifies how the items of the repository are organized.
    `void` | `setMetadataSupplier​(Class<? extends ComponentMetadataSupplier> rule)` | Sets a custom metadata rule, which is capable of supplying the metadata of a component (status, status scheme, changing flag) whenever a dynamic version is requested.
    `void` | `setMetadataSupplier​(Class<? extends ComponentMetadataSupplier> rule, Action<? super ActionConfiguration> configureAction)` | Sets a custom metadata rule, possibly configuring the rule.
    `void` | `setUrl​(Object url)` | Sets the base URL of this repository.
    `void` | `setUrl​(URI url)` | Sets the base URL of this repository.

    - ### Methods inherited from interface org.gradle.api.artifacts.repositories.ArtifactRepository

      `content, getName, setName`

    - ### Methods inherited from interface org.gradle.api.artifacts.repositories.AuthenticationSupported

      `authentication, credentials, credentials, credentials, getAuthentication, getCredentials, getCredentials`

    - ### Methods inherited from interface org.gradle.api.artifacts.repositories.MetadataSupplierAware

      `setComponentVersionsLister, setComponentVersionsLister`

    - ### Methods inherited from interface org.gradle.api.artifacts.repositories.UrlArtifactRepository

      `isAllowInsecureProtocol, setAllowInsecureProtocol`

- - ### Field Detail

    - #### IVY_ARTIFACT_PATTERN

          static final String IVY_ARTIFACT_PATTERN

      See Also:
        Constant Field Values

    - #### GRADLE_ARTIFACT_PATTERN

          static final String GRADLE_ARTIFACT_PATTERN

      See Also:
        Constant Field Values

    - #### GRADLE_IVY_PATTERN

          static final String GRADLE_IVY_PATTERN

      See Also:
        Constant Field Values

    - #### MAVEN_ARTIFACT_PATTERN

          static final String MAVEN_ARTIFACT_PATTERN

      See Also:
        Constant Field Values

    - #### MAVEN_IVY_PATTERN

          static final String MAVEN_IVY_PATTERN

      See Also:
        Constant Field Values

  - ### Method Detail

    - #### getUrl

          URI getUrl()

      The base URL of this repository.
      Specified by:
        `getUrl` in interface `UrlArtifactRepository`
      Returns:
        The URL.

    - #### setUrl

          void setUrl​(URI url)

      Sets the base URL of this repository.
      Specified by:
        `setUrl` in interface `UrlArtifactRepository`
      Parameters:
        `url` - The base URL.
      Since:
        4.0

    - #### setUrl

          void setUrl​(Object url)

      Sets the base URL of this repository. The provided value is evaluated as per `Project.uri(Object)`. This means, for example, you can pass in a File object or a relative path which is evaluated relative to the project directory. File are resolved based on the supplied URL and the configured `layout(String, Closure)` for this repository.
      Specified by:
        `setUrl` in interface `UrlArtifactRepository`
      Parameters:
        `url` - The base URL.

    - #### artifactPattern

          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 `ivyPattern(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 `setUrl(Object)`. Patterns added in this way will be in addition to any layout-based patterns added via `setUrl(Object)`.
      Parameters:
        `pattern` - The artifact pattern.

    - #### ivyPattern

          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 `setUrl(Object)`. Patterns added in this way will be in addition to any layout-based patterns added via `setUrl(Object)`.
      Parameters:
        `pattern` - The ivy pattern.

    - #### layout

          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])"`
      Parameters:
        `layoutName` - The name of the layout to use.
      See Also:
        `patternLayout(Action)`

    - #### layout

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

      Deprecated.
      use `layout(String)` or `patternLayout(Action)`
      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.

      Parameters:
        `layoutName` - The name of the layout to use.
        `config` - The action used to configure the layout.
      Since:
        2.3 (feature was already present in Groovy DSL, this particular method introduced in 2.3)

    - #### patternLayout

          void patternLayout​(Action<? super IvyPatternRepositoryLayout> config)

      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.

      Parameters:
        `config` - The action used to configure the layout.
      Since:
        5.0

    - #### layout

          @Deprecated
          void layout​(String layoutName,
                      Closure config)

      Deprecated.
      use `layout(String)` or `patternLayout(Action)`
      Specifies how the items of the repository are organized. See `layout(String, org.gradle.api.Action)`
      Parameters:
        `layoutName` - The name of the layout to use.
        `config` - The closure used to configure the layout. An instance of `RepositoryLayout` is passed as a parameter to the closure.

    - #### getResolve

          IvyArtifactRepositoryMetaDataProvider getResolve()

      Returns 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.
      Returns:
        The meta-data provider for this repository.

    - #### setMetadataSupplier

          void setMetadataSupplier​(Class<? extends ComponentMetadataSupplier> rule)

      Sets a custom metadata rule, which is capable of supplying the metadata of a component (status, status scheme, changing flag) whenever a dynamic version is requested. It can be used to provide metadata directly, instead of having to parse the Ivy descriptor.
      Specified by:
        `setMetadataSupplier` in interface `MetadataSupplierAware`
      Parameters:
        `rule` - the class of the rule. Gradle will instantiate a new rule for each dependency which requires metadata.
      Since:
        4.0

    - #### setMetadataSupplier

          void setMetadataSupplier​(Class<? extends ComponentMetadataSupplier> rule,
                                   Action<? super ActionConfiguration> configureAction)

      Sets a custom metadata rule, possibly configuring the rule.
      Specified by:
        `setMetadataSupplier` in interface `MetadataSupplierAware`
      Parameters:
        `rule` - the class of the rule. Gradle will instantiate a new rule for each dependency which requires metadata.
        `configureAction` - the action to use to configure the rule.
      Since:
        4.0

    - #### metadataSources

          void metadataSources​(Action<? super IvyArtifactRepository.MetadataSources> configureAction)

      Configures the metadata sources for this repository. This method will replace any previously configured sources of metadata.
      Parameters:
        `configureAction` - the configuration of metadata sources.
      Since:
        4.5

    - #### getMetadataSources

          @Incubating
          IvyArtifactRepository.MetadataSources getMetadataSources()

      Returns the current metadata sources configuration for the repository.
      Since:
        6.4