Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

How to retrieve an artifact from an asset using Apache Ant

Hi,

I am trying to retrieve an artifact from an asset located on a RAM server using the provided Apache Ant tasks. The asset has a folder structure each containing several JAR files. What I am trying to accomplish is downloading just one specific JAR file from that particular asset but for some reason the Apache Ant download task always downloads the complete asset contents.

How would I accomplish just downloading a single file from a particular asset? This is my Apache Ant target doing the download:

<ram:download server="ramServer" destdir="${im.root.dir}" extract="true">

<ram:asset guid="{58FA0B7A-8D98-E264-B969-2CD4D6046B09}" version="1.4.1">
<ram:artifact file="agent.installer.linux.gtk.x86_1.4.1000.20100810_1125.zip" />
</ram:asset>
</ram:download>


Cheers
Daniel S. Haischt

0 votes


Accepted answer

Permanent link
The path attribute should not contain the name of the file. It's only used for specifying the folder structure leading to the file in the asset. If the artifact you want is in the root of the asset, you can omit the path attribute. So in your case, use path="/Installation Manager 1.4.1".
Daniel Stefan Haischt selected this answer as the correct answer

0 votes


4 other answers

Permanent link
Hi,

I think the presence of the <asset> element within the download tells it
to bring down the entire asset. I think the better way would be to
specify the asset separately and give it an id and then use only the
artifact in the download itself, with a reference back to the previously
defined asset entry.

<asset>
<download>
<artifact>
</download>

Rich

0 votes


Permanent link
Rich is correct (but his XML was mangled by the forum... select "Disable HTML in this post" if you're going to include XML). Here's what you need to do:


<ram:asset id="myAsset" server="ramServer" guid="{58FA0B7A-8D98-E264-B969-2CD4D6046B09}" version="1.4.1" />
<ram:download destdir="${im.root.dir}" server="ramServer" extract="true">
<ram:artifact name="agent.installer.linux.gtk.x86_1.4.1000.20100810_1125.zip" path="/path/to/artifact" asset="myAsset" />
</ram:download>

0 votes


Permanent link
Hi,

if I use the following code...

        <target name="getInstallationManagerFromRAM.linux" depends="" unless="im.linux.zip.file.exists">

<echo message="Downloading IBM Installation Manager for Linux to: ${im.root.dir}" />
<ram:download server="ramServer" destdir="${im.root.dir}" extract="true">
<ram:artifact name="agent.installer.linux.gtk.x86_1.4.1000.20100810_1125.zip"
asset="capilanoAsset"
path="/Installation Manager 1.4.1/agent.installer.linux.gtk.x86_1.4.1000.20100810_1125.zip" />
</ram:download>
</target>


I am getting the following stack trace:

getInstallationManagerFromRAM.linux:

[echo] Downloading IBM Installation Manager for Linux to: ../../../../3rd-party-dependencies/installation-manager/1.4.1

BUILD FAILED
/home/dsh/projects/workspaces/pkgdev131-ips-20101005-lnx-x8664/com.ibm.is.sappack.gen.releng/src/build.master.xml:348: The following error occurred while executing this line:
/home/dsh/projects/workspaces/pkgdev131-ips-20101005-lnx-x8664/com.ibm.is.sappack.gen.releng/src/build.master.xml:329: The following error occurred while executing this line:
/home/dsh/projects/workspaces/pkgdev131-ips-20101005-lnx-x8664/com.ibm.is.sappack.gen.releng/src/build.master.xml:266: The following error occurred while executing this line:
/home/dsh/projects/workspaces/pkgdev131-ips-20101005-lnx-x8664/com.ibm.is.sappack.gen.releng/src/build.common.package.xml:49: java.lang.ClassCastException: com.ibm.ram.client.RAMArtifact incompatible with com.ibm.ram.client.RAMFolderArtifact
at com.ibm.ram.client.RAMFolderArtifact.getChild(RAMFolderArtifact.java:522)
at com.ibm.ram.client.RAMFolderArtifact.getChild(RAMFolderArtifact.java:522)
at com.ibm.ram.internal.client.ant.types.Artifact.getArtifact(Artifact.java:197)
at com.ibm.ram.internal.client.ant.types.Artifact.getModel(Artifact.java:161)
at com.ibm.ram.internal.client.ant.tasks.DownloadTask.downloadArtifacts(DownloadTask.java:344)
at com.ibm.ram.internal.client.ant.tasks.DownloadTask.execute(DownloadTask.java:462)


Not sure what's going wrong.

Regards
Daniel S. Haischt

0 votes


Permanent link
The path attribute should not contain the name of the file. It's only used for specifying the folder structure leading to the file in the asset. If the artifact you want is in the root of the asset, you can omit the path attribute. So in your case, use path="/Installation Manager 1.4.1".


Thanks that did the trick!

Cheers
Daniel

0 votes

Your answer

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details

Question asked: Oct 08 '10, 1:26 a.m.

Question was seen: 8,189 times

Last updated: Oct 08 '10, 1:26 a.m.

Confirmation Cancel Confirm