mhvelplund
mhvelplund

Reputation: 2341

Why does Artifactory require an explicit artifact for some Ivy dependencies

I have an Artifactory server that I use to resolve Ivy dependencies. When I want to add a dependency to my ivy.xml, I sometimes have to add an explicit nested <artifact> tag, and I don't understand why.

Example A:

<dependency org="com.google" name="guava" rev="[7,)" conf="compile,runtime" />

Example B

<dependency org="com.twelvemonkeys.common" name="common-image" rev="3.0.1" conf="compile,runtime">
  <artifact name="common-image" ext="jar"/>
</dependency>

Looking at the cached dependencies in the Artifactory tree view, there's nothing that indicates that the last example should need extra info to resolve the dependency, but Artifactory suggests it itself, and the resolution doesn't work without out.

I'm using Ivy against a repository with Maven layout. My settings where generated by Artifactory and look something like:

<?xml version="1.0" encoding="UTF-8"?>
<ivy-settings>
  <settings defaultResolver="main" />
  <resolvers>
    <chain name="main">
      <ibiblio 
        name="public" 
        m2compatible="true" 
        root="http://example.org/artifactory/remote-repos" />
    </chain>
  </resolvers>
</ivy-settings>

Why does Artifactory require an explicit artifact for some Ivy dependencies and not for others?

Edit 20151005: Added Ivy settings example

Upvotes: 0

Views: 176

Answers (1)

Dror Bereznitsky
Dror Bereznitsky

Reputation: 20376

The tool performing the dependency resolution is the Ivy client and not Artifactory. Based on the dependency deceleration the Ivy resolver decides which artifact to request from the repository (in your case it is Artifactory).
The artifact feature provides 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.
For more information about the artifact feature and when it should be used consult the Ivy documentation.

Upvotes: 1

Related Questions