0

How to publish multiple jar files having different version number in Nexus Sonatype Repository using ivy and ant.

How Can Write ivy.xml file ??

Suppose I have following two jar files

  1. addressing-1.0.jar and
  2. castor-1.3.jar

How Should I provide version number in ivy.xml as there are two different version number here(1.0 and 1.3) to publish these jar files in Nexus Sonatype Repository with appropriate version numbers.

Thanking You

Looking for reply to this question. please

Ankush Rasse
  • 11
  • 1
  • 6

1 Answers1

1

All the files published by a build would be associated with the same release revision.

I suspect that what you need to do is upload dependencies? In which case the simplest way is to use the Nexus GUI or the following answer

Explanation

The ivy file describes both the project dependencies and the files generated and published by the project.

So for example the following files lists the two files which ivy will upload into Nexus, a jar and a POM file:

<ivy-module version='2.0'>

    <info organisation="com.myspotonontheweb" module="donaldduck"/>

    <publications>
        <artifact name="donaldduck" type="jar"/>
        <artifact name="donaldduck" type="pom"/>
    </publications>

    <dependencies>
         ..
         ..
    <dependencies/>

</ivy-module>

The point is... All files published by this module would have the same version number. And this is specified by the publish task (See pubrevision attribute):

<ivy:publish resolver="nexus" pubrevision="${publish.revision}" overwrite="true" publishivy="false" >
    <artifacts pattern="${build.dir}/[artifact].[ext]"/>
</ivy:publish>

Observation

The files in your example are looks like files available from Maven Central. This means they're automatically proxied by your Nexus server, and can be included in your project as dependencies:

    <dependencies>
        <dependency org="net.sourceforge.addressing" name="addressing" rev="1.1.1"/>
        <dependency org="org.codehaus.castor" name="castor" rev="1.2"/>
    <dependencies/>
Community
  • 1
  • 1
Mark O'Connor
  • 76,015
  • 10
  • 139
  • 185
  • So there is no other way to publish jar having different version number using ivy and ant ? – Ankush Rasse Jun 18 '12 at 10:30
  • You missed the point. Artifacts published by a ivy module or a Maven POM normally have the same revision number. You could use two different ivy files to achieve what you want to achieve, but then you're making a lot of effort for little gain. Follow my link on uoloading Maven artifacts for the simplest way to get something into Maven (using command-line) – Mark O'Connor Jun 18 '12 at 17:47