////
   Licensed to the Apache Software Foundation (ASF) under one
   or more contributor license agreements.  See the NOTICE file
   distributed with this work for additional information
   regarding copyright ownership.  The ASF licenses this file
   to you under the Apache License, Version 2.0 (the
   "License"); you may not use this file except in compliance
   with the License.  You may obtain a copy of the License at

     https://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing,
   software distributed under the License is distributed on an
   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
   KIND, either express or implied.  See the License for the
   specific language governing permissions and limitations
   under the License.
////

*Tag:* artifact *Parent:* link:../ivyfile/dependency{outfilesuffix}[dependency]

This feature gives you more control on a dependency for which you do not control its Ivy file.
It enables to specify the artifacts required, if the dependency has no Ivy file.

Indeed, when a module has no Ivy file, it is assumed that it publishes exactly one artifact having the same name as the module itself. But when this module publishes more artifacts, or simply does not respect the name rule, and if you cannot deliver an Ivy file for it (because you do not control the repository, for instance - think about Maven ibiblio repository, to give no name), then this feature lets you specify the artifact names you want to get.

Each artifact specification can be given in the context of particular master configurations. By default, if no configuration is specified, artifacts specification apply to all master configurations. But you can specify that a specification applies only to one or several master configurations, using either inline or nested conf specification. In this case, do not forget that if you do not specify any specification for a particular configuration, then no specification will apply for this configuration and it will be resolved not taking into account any specification.

For instance, imagine you have A, B & C master configurations. If you specify art1 in A & B and art2 in A, then C will not be specified at all, and will thus assume the default artifact. To prevent this, you have to specify a configuration mapping for the dependency, mapping only A & B to some or all dependency configurations.

Example:
[source,xml]
----
<dependency org="yourorg" name="yourmodule9" rev="9.1" conf="A,B->default">
  <artifact name="art1" type="jar" conf="A,B"/>
  <artifact name="art2" type="jar" conf="A"/>
</dependency>
----

(*__since 1.4__*) It's possible to indicate the URL at which the artifact can be found. This is not mandatory, and even not recommended with an enterprise repository. Note that Ivy will always look at the location where the artifact should be and only use the URL if it cannot be found at the standard location in the repository.

(*__since 1.4__*) This tag supports link:../concept{outfilesuffix}#extra[extra attributes].

(*__since 2.0__*) This feature can also be used for modules having their own module descriptor, but which doesn't declare an artifact you know that is published. Note that in this case artifacts declared to be published by the dependency will be ignored, so do not forget to include all artifacts you want.

== Attributes

[options="header",cols="15%,50%,35%"]
|=======
|Attribute|Description|Required
|name|the name of an artifact of the dependency module|Yes
|type|the type of the artifact of the dependency module|Yes
|ext|the extension of the artifact of the dependency module|No, defaults to type
|conf|comma separated list of the master configurations in which this artifact should be included.

`$$*$$` wildcard can be used to designate all configurations of this module|No, defaults to `$$*$$`, unless nested conf are specified
|url|an URL where this artifact can be found if it isn't present at the standard location in the repository (*__since 1.4__*)|No, defaults to no URL
|=======

== Child elements

[options="header",cols="20%,60%,20%"]
|=======
|Element|Description|Cardinality
|link:../ivyfile/dependency-artifact-conf{outfilesuffix}[conf]|configuration in which the artifact should be included|0..n
|=======

== Examples

[source,xml]
----
<dependency org="foo" name="bar" rev="1.0">
  <artifact name="baz" type="jar"/>
</dependency>
----

Declares a dependency on module bar which only publish one artifact: `baz.jar`.

'''

[source,xml]
----
<dependency org="foo" name="bar" rev="1.0">
  <artifact name="baz" type="jar" url="http://www.acme.com/repository/bar/baz-1.0-acme.jar"/>
</dependency>
----

Same as above, except that if the artifact is not found at its standard location, Ivy will use `$$http://www.acme.com/repository/bar/baz-1.0-acme.jar$$` to download it.

'''

[source,xml]
----
<dependency org="foo" name="bar" rev="1.0">
  <include name="*"/>
  <artifact name="baz" type="source" ext="jar"/>
</dependency>
----

Declares a dependency on module bar for which all artifacts declared will be used (thanks to the `include` tag) plus an artifact `baz` of type `source` and ext `jar` (which is not declared in module bar module descriptor).
