Omar Al Kababji
Omar Al Kababji

Reputation: 1828

Getting several jars from artifactory as a package

I am trying to understand how to manage this situation, suppose I have a 3rd party library (best-lib) that consists of three jars (a.jar, b.jar, c.jar) and I will be uploading those jars to a personal Artifactory server, the (best-lib) has two versions 1.0 and 2.0.

What I would like to have in my ivy.xml file is one single dependency to retrieve all those jars at once for example:

<dependencies>
    <dependency org="mycompany" name="best-lib" rev="1.0" />
</dependencies>

And this dependency should add all three jars (a, b, and c) of version 1.0.

The question is:

  1. Is this possible?
  2. How can I upload the three jars to artifactory to achieve this behaviour?
  3. Is it possible to upload those jars all at once?
  4. Artifactory alternative solutions are also acceptable (e.g. Nexus or Archivia).

Note: I am not building best-lib I just have its jars, and best-lib is not a library that can be downloaded from a public maven2 repository.

Thanks.

Upvotes: 0

Views: 924

Answers (1)

Mark O&#39;Connor
Mark O&#39;Connor

Reputation: 77951

When publishing the "best-lib" module, use an ivy.xml file that lists the 3 jars published by the module:

<ivy-module version="2.0">
    <info organisation="mycompany" module="best-lib"/>

    <publications>
        <artifact name="a" type="jar"/>
        <artifact name="b" type="jar"/>
        <artifact name="c" type="jar"/>
    </publications>
    ..
    ..

When you create a dependency against this module, ivy will understand that there are 3 jars in this module.

For an example of how to publish an ivy module see:

Update

If the 3 jars are already in your repository you could publish a stand-alone ivy modules that references the other 3 as dependencies:

<ivy-module version="2.0">
    <info organisation="mycompany" module="best-lib" rev="1.0"/>

    <dependences>
       <dependency org="mycompany" name="a" rev="1.0" />
       <dependency org="mycompany" name="b" rev="1.0" />
       <dependency org="mycompany" name="c" rev="1.0" />
    </dependencies>

Finally, you may need to tell us what format your Artifactory repository uses.... I have been assuming it's an ivy repo. If it's Maven then the concepts are the same but obviously server-side we'd be talking about pom.xml files, instead of ivy.xml (Ivy supports Maven repositories).

Upvotes: 2

Related Questions