0
votes

I'm setting up my first "managed" Ivy repository via Artifactory and am wondering if I have to hand-write all the Ivy descriptors (XMLs) for each artifact I deploy.

This would be painful.

What do "real" repo admins do in these situations? Hand-write them? Wrtie scripts to generate them for you? Is there the Ivy equivalent to Maven Central Repository where I can just copy down descriptors from? If I go to http://mvnrepository.com/ and search for a JAR I see it has an "Ivy" tab next to the "Maven" one, but it just contains the <dependency/> element, not the entire <ivy-module> XML instance that Ivy needs.

3

3 Answers

2
votes

After rereading your question I realized that I answered something else :) Sorry about that. There are number of things you can do:

  1. First, look at Ivy RoundUp. It is Ivy repository that you can proxy in Artifactory.
  2. If it is not sufficient (i.e. the dependencies you are after aren't there) think about developing some kind of translation from Maven's POM (xslt can help, maybe some script in groovy or ruby if you are good with them).
  3. The most radical solution might be switching build tool. I'd strongly suggest Gradle, it uses Ivy under the hood for dependency management, but has lots of advantages over Ant. One of them that is relevant to our discussion - it generates all the needed metadata on deploy.
0
votes

You don't need any other tool. Just browse Artifactory tree, find the dependency you need. On the General panel look for Dependency Declaration section. Select "Ivy" from drop-down list. Ivy dependency declaration will appear. Point your mouse to it. "View source", "Copy to clipboard" and "Print" buttons will appear. Select copy. Now you have the correct declaration in you clipboard.

Here's a screenshot

0
votes

You can use the ivy:install ant target to easily import modules from other repositories:

    <target name="--install.do" if="valid.args">
        <ivy:install 
              organisation="${org}" 
              module="${module}" 
              revision="${version}"
              from="${from}"
              to="local" 
              transitive="false" 
              overwrite="true"/>
    </target>

Where ${from} is the name of a resolver defined in your ivy.settings.file.