Jump to: navigation, search

Stardust/Knowledge Base/BuildChangeMgmt/Ivy

Retrieving Artifacts via Ivy Integrated Ant Task

You can use Apache Ivy ant tasks to receive the artifacts and build your work environment. For details on using Ivy, please refer to the Apache Ivy Site.

The following code snippets illustrate how for the configurations files can be configured:

ivy.xml
<?xml version="1.0" encoding="UTF-8"?>
<ivy-module version="2.0" xmlns:m="http://ant.apache.org/ivy/maven" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd">
  <info organisation="<organisation.name>" module="<ipp-client-tool>" revision="<x.y.z>" />
  <configurations>
    <conf name="ipp-tools" />
  </configurations>
  <dependencies>
    <dependency org="com.infinity.bpm" name="ipp-tools" rev="" conf="ipp-tools->default">
      <artifact name="ipp-tools" type="zip"/>
    </dependency>
  </dependencies>
</ivy-module>
</pre> 
'''|ivy-settings.xml'''<br> 
<pre><?xml version="1.0" encoding="UTF-8"?>
<ivysettings>
  <property name="ipp.m2.repository" value="https://internal.csa.sungard.com/artifactory" override="false"/>
  <property name="default.ivy.cache" value="/.cache" override="false"/>
  <caches>
    <cache name="ipp-tools-ivy-cache" basedir="" useOrigin="true" />
  </caches>
  <resolvers>
    <ibiblio name="ipp-releases" root="/ipp-libs" m2compatible="true" cache="ipp-tools-ivy-cache"/>
  </resolvers>
  <settings defaultResolver="ipp-releases"/>
</ivysettings>
</pre> 
'''build.xml''' 
<pre><?xml version="1.0" encoding="UTF-8"?>
<project name="retrieve-ipp-tools" default="retrieve-ipp-tools" xmlns:ivy="antlib:org.apache.ivy.ant">
<property name="ivy.install.version" value="2.2.0" />
<property name="ivy.jar.dir" value="/ivy" />
<property name="ivy.jar.file" value="/ivy.jar" />
<property name="ivy.settings.file" value="ivy-settings.xml" />
<property name="m2.server.host" value="internal.csa.sungard.com" />
<property name="m2.server.auth.realm" value="Artifactory Realm" />
<property name="m2.server.auth.username" value="<i>username</i>" />
<property name="m2.server.auth.password" value="<i>password</i>" />
<property name="ipp.version" value="latest.integration" />
<!-- Downloading ivy -->
<target name="download-ivy" unless="skip.download" description="Downloading ivy">
  <mkdir dir=""/>
  <get src="http://repo1.maven.org/maven2/org/apache/ivy/ivy//ivy-.jar" dest="" usetimestamp="true"/>
</target>
<!-- Installing ivy -->
<target name="install-ivy" depends="download-ivy" description="Installing ivy">
  <path id="ivy.lib.path">
    <fileset dir="" includes="*.jar"/>
  </path>
  <taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant" classpathref="ivy.lib.path"/>
</target>
<!-- Setting up ivy -->
<target name="setup-ivy" depends="install-ivy" description="Setting up ivy">
  <ivy:settings id="ivy.instance" file="">
    <ivy:credentials host="" realm="" username="" passwd="" />
  </ivy:settings>
</target>
<!-- Retrieving IPP Tools -->
<target name="retrieve-ipp-tools" depends="setup-ivy" description="Retrieving IPP Tools">
  <ivy:resolve/>
  <ivy:retrieve conf="ipp-tools" pattern="[artifact].[ext]" type="zip"/>
  <unzip dest="." src="ipp-tools.zip"/>
</target>
</project>

Run the build file to retrieve the ipp-tools.zip archive. Please take care to use the right proxy settings in your Java environment.

Building your Work Environment via Ivy Integrated Ant Tasks

Unzip the downloaded or created ipp-tools.zip file.

After doing so, you find a ipp-ivy-cred.properties file in the etc folder. Open this file and set the appropriate user and password, e.g.:

m2.server.host = internal.csa.sungard.com
m2.server.auth.realm = Artifactory Realm
m2.server.auth.username = username
m2.server.auth.password = password

All needed Ivy files are downloaded as well:

  • ivy.xml - to declare the project's modules and dependencies.
  • ivy-settings.xml - to configure artifact resolution.
  • build.xml - to execute the ANT tasks for artifact resolution.

Now execute the ANT target retrieve-ipp-tools, which you find in the provided build.xml file.

All artifacts like documentation, runtime, client scripts etc., will be downloaded. To get an overview about the runtime dependencies, you can execute the ANT target report of the build.xml file. Per default, the latest integration is used to retrieve the appropriate version. Thus, you always get the latest version, that can be found in the repository. If you are interested in a specific version, you can either pass the version via a parameter, e.g.
-Dipp.version=6.0.2
or you can permanently store this parameter in the etc/build.properties file.

Including Third Party Libraries

You need to set up a custom repository to include the following third party libraries:

  • jai-imageio-1.1.jar - javax.media.group-id
  • stax-ex-1.0.jar - org.jvnet.staxex
  • streambuffer-0.4.jar - com.sun.xml.stream.buffer
In your ivy-settings.xml, add your custom repository in the resolvers section, e.g.:
<ibiblio name="ipp-nondistributable"
root="/ipp-3rd-party-nondistributable"
m2compatible="true" cache="ipp-tools-ivy-cache"/>
In the chain section, add a reference to this repository:
<chain name="pull-ipp-deps">

... <resolver ref="ipp-nondistributable" /> ...

</chain>