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:
Cheers
Daniel S. Haischt
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
Accepted answer
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".
4 other answers
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
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
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>
Hi,
if I use the following code...
I am getting the following stack trace:
Not sure what's going wrong.
Regards
Daniel S. Haischt
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
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