views:

795

answers:

1

If my ivysettings.xml file includes:

<url name="com.springsource.repository.bundles.external">
    <ivy pattern="http://repository.springsource.com/ivy/bundles/external/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]" />
    <artifact pattern="http://repository.springsource.com/ivy/bundles/external/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]" />
</url>

And my ivy.xml file includes:

<dependency org="org.junit"
            name="com.springsource.org.junit" 
            rev="4.4.0" />

From when I ran Ivy, I can tell that this resolves to: http://repository.springsource.com/ivy/bundles/external/org.junit/com.springsource.org.junit/4.4.0/com.springsource.org.junit-sources-4.4.0.jar

So the resolutions go:

[organization] => "org.junit"
[module] => "com.springsource.org.junit"
[revision] => "4.4.0"
[artifact] => "com.springsource.org.junit-sources"
[ext] => "jar"

I see how ivy resolves the [organisation], [module], and [revision] in the URL pattern (duh), but how does it resolve [artifact] and [ext]?

The documentation on the URL resolver seems to be lacking.

A: 

Ivy first resolves the <ivy pattern... />, with the organization, module, and revision given, and with the [artifact] hardcoded as "ivy" and [ext] hardcoded as "xml". This yields a URL, in this case:

http://repository.springsource.com/ivy/bundles/external/org.junit/com.springsource.org.junit/4.4.0/ivy-4.4.0.xml

This is the ivy configuration file for this module. Among other things, this ivy configuration file contains information about other artifacts, in particular:

<artifact name="com.springsource.org.junit-sources" type="src" ext="jar"/>
<artifact name="license" type="license" ext="txt"/>

These two are then used to complete the <artifact pattern... /> part - to download the license and to download the jar file.

Andrey Fedorov