# Chain Resolver
Tag | chain
Handle latest | depends on sub resolvers
Handle publish | delegates to first sub resolver in chain
This resolver is only a container of a chain of other resolvers. The sub resolvers can be any resolver, including a chain. An attribute `enable` to indicate if the chain must be iterated after the first found or not (at least when asking for a latest revision). If the chain is iterated, then it’s the latest among the ones found that is returned. If the chain is not iterated, then it’s the first found which is returned. ## Attributes This resolver shares the common attributes of composite resolvers.
Attribute | Description | Required
--- | --- | ---
returnFirst | true if the first found should be returned. | No, defaults to false
dual | true if the chain should behave like a dual chain. (since 1.3) | No, defaults to false
## Child elements
Element | Description | Cardinality
--- | --- | ---
any resolver | a sub resolver to use | 1..n
## Examples
    <chain name="test">
      <filesystem name="1">
        <ivy pattern="${ivy.settings.dir}/1/[organisation]/[module]/ivys/ivy-[revision].xml"/>
        <artifact pattern="${ivy.settings.dir}/1/[organisation]/[module]/[type]s/[artifact]-[revision].[ext]"/>
      </filesystem>
      <ivyrep name="2"/>
    </chain>
Both a filesystem and ivyrep will be used to look for Ivy files. If a dynamic revision is required, then both the filesystem and ivyrep will be queried to find the most recent revision among the two resolvers. Once the most recent revision is found in one resolver, it’s the same resolver which will be used to download artifacts.
    <chain name="test" returnFirst="true">
      <filesystem name="1">
        <ivy pattern="${ivy.settings.dir}/1/[organisation]/[module]/ivys/ivy-[revision].xml"/>
        <artifact pattern="${ivy.settings.dir}/1/[organisation]/[module]/[type]s/[artifact]-[revision].[ext]"/>
      </filesystem>
      <ivyrep name="2"/>
    </chain>
Same as before, except that if a revision is found in the filesystem then ivyrep will not be queried: its the filesystem which will be used for both the Ivy file and the artifacts.
    <chain name="test" dual="true">
      <filesystem name="1">
        <ivy pattern="${ivy.settings.dir}/1/[organisation]/[module]/ivys/ivy-[revision].xml"/>
        <artifact pattern="${ivy.settings.dir}/1/[organisation]/[module]/[type]s/[artifact]-[revision].[ext]"/>
      </filesystem>
      <ivyrep name="2"/>
    </chain>
Same as first example, except that once a module is found by either filesystem or ivyrep, then it’s the whole chain which will be queried to download the artifacts. So in this case Ivy file and artifacts may be split across the two resolvers for the same module.