0

i am using Apache Ant with Ivy to publish artifacts to Artifactory-Server. The way i do this is to generate a pom-File from ivy.xml. However with different names for modules and artifacts. If i retrieve the artifacts from server only the artifacts with the same names are downloaded.

ivy.xml:

<?xml version="1.0" encoding="ISO-8859-1"?>
<ivy-module version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd">
    <info organisation="com.ibm" module="db2_driver" revision="4.19.26"/>
    <publications>
        <artifact name="db2jcc4_license_cisuz" type="jar" conf="default" ext="jar" /> 
        <artifact name="db2jcc4"               type="jar" conf="default" ext="jar" /> 
        <artifact name="db2_driver"            type="pom" conf="default" ext="pom"  /> 
    </publications>
</ivy-module>

build.xml:

<?xml version="1.0" encoding="UTF-8"?>
<project name="IVY_TEST" default="ivypom" basedir="." xmlns:ivy="antlib:org.apache.ivy.ant">

     <property file="build.properties" /> <!- defines ${artifact.path} -->

     <target name="ivypom" >

         <ivy:makepom ivyfile="${artifact.path}/ivy.xml" pomfile="${artifact.path}/db2_driver.pom" >
            <mapping conf="*" scope="*" />
         </ivy:makepom>

         <ivy:publish resolver="main" module="[ivy.module]" revision="4.19.26" organisation="[ivy.organisation]" overwrite="true">          
            <artifacts pattern="${artifact.path}/[artifact].[ext]" /> 
         </ivy:publish>

     </target>      
</project>

The Upload is succesfully...

That's the result (Artifactory Browser):

- db2_driver
  - 4.14.22
  - 4.19.26
    - db2_driver-4.19.26.pom
    - db2jcc4-4.19.26.jar
    - db2jcc4_license_cisuz-4.19.26.jar
    - ivy-4.19.26.xml

generated pom-File:

<modelVersion>4.0.0</modelVersion>
<groupId>com.ibm</groupId>
<artifactId>db2_driver</artifactId>
<packaging>pom</packaging>
<version>4.19.26</version>

Now I want to use the driver.

The needed ivy.xml for the application:

<?xml version="1.0" encoding="ISO-8859-1"?>
<ivy-module version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd">
   <info organisation="de.xxx" module="main_steuerprogramm" revision="1.0.0"/>
   <configurations>
       <conf name="default" description="Standard Konfiguration" /> 
   </configurations>
   <dependencies>
       <dependency org="com.ibm" name="db2_driver" rev="4.19.26"/>
    </dependencies>
</ivy-module>

But it don't work. How can I retrieve the jars?

There are three good answers...

But in my case the name of the artifacts are different to module name. That's the difficulty.

Please help.

Community
  • 1
  • 1
akr
  • 1
  • 2
  • And see: http://stackoverflow.com/questions/5111831/how-to-publish-3rdparty-artifacts-with-ivy-and-nexus/5115447#5115447 – Mark O'Connor Jul 01 '15 at 18:12
  • and: http://stackoverflow.com/questions/9426011/convert-ivy-xml-to-pom-xml/9429286#9429286 – Mark O'Connor Jul 01 '15 at 18:12
  • and how to retrieve Maven artifacts with classifiers: http://stackoverflow.com/questions/6942989/ivy-cant-download-because-pom-file-and-the-jar-file-name-arent-matching-patt/6949758#6949758 – Mark O'Connor Jul 01 '15 at 18:19

0 Answers0