0
votes

When I publish my artifact (some api jar), how do I specify version ? is it revision attribute ? I want to have client-lib-1.0.jar

<ivy-module>
<info organisation="the.org" module="client-lib" revision ="1.0">
<info>
</ivy-module>
1

1 Answers

1
votes

Firstly, you need to include a publications section, telling ivy what arifacts you are publishing as a module. Ivy is very flexible and quite capable of publishing modules with multiple files and/or types.

 <publications>
    <artifact name="client-lib" type="jar"/>
    <artifact name="client-lib" type="jar" e:classifier="source"/>
    <artifact name="client-lib" type="jat" e:classifier="javadocs"/>    
 </publications>

Secondly (and the answer to your question) the revision number of the published ivy file is decided at publish time. It gets set by the special "pubrevision" attribute of the publish task. Ivy will search the artifact pattern for the file(s) listed in the ivy file to be published.

<ivy:publish resolver="my-deploy" pubrevision="1.0">
    <artifacts pattern="${build.dir}/[artifact](-[classifier]).[ext]"/>
</ivy:publish>

Under the hood a new ivy file is being generated and uploaded alongside the module's file.


How the file is stored in the repository is a matter decided by ivy resolver.

An issue you're likely to encounter is that few people host an Ivy repository these days. Instead Maven is the most common standard.

The following detailed detailed example(s) describes how this process works including the messy POM generation stuff (cause Maven doesn't understand ivy files):