Solved

ANT ZIP Task

Posted on 2006-11-08
3
2,186 Views
Last Modified: 2012-06-22
I've created an ANT project that successfully creates a ZIP archive of documents I want to provide as part of our product release.
However, the COPY task does not copy and move the created ZIP archive. When I just create a task to move a file, it works fine. I am using DEPENDS to make a dependency between the zipping and copying but to no avail. What am I missing?
Here's the build file:

<project name="buildDocArchive" default="makeZIP" basedir=".">
<target name="init">
      <property name="archiveName" value="OurDocs"/>
</target>
 
<target name="makeZIP" depends="init">
  <zip zipfile="${archiveName}.zip" update="no">
     <fileset dir=".">
              <include name="Docs/**/*.pdf"/>
              <exclude name="**/*.doc"/>
          <exclude name="**/*.xml"/>
          <exclude name="**/*.zip"/>
            </fileset>
      </zip>
 </target>
 <target name="copyIt" depends="makeZIP">
    <copy file="${archiveName}.zip" todir="Z:\TechPubTeam" />
 </target>
   
</project>
0
Comment
Question by:paulReeves
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 92

Accepted Solution

by:
objects earned 500 total points
ID: 17904184
looks fine, perhaps try:

    <copy file="${archiveName}.zip" todir="Z:/TechPubTeam" />
0
 

Author Comment

by:paulReeves
ID: 17908490
Thanks for quick response. I've tried that but it doesn't work. I just tried removing the zip building activity (again) and confirmed that the copy task does work when it is not dependent on the the zip building task.

I would think using the depends parameter would ensure that the copy task wouldn't start until the zip archive was finished building.

Is there a way to call another build file inside an Ant script? Maybe if I just put the copy task in a separate build file as a distinct task...
0
 

Author Comment

by:paulReeves
ID: 17908938
Solved it.

I set the default task to the last task, copyIt, and then the dependencies kicked in and it was called.

So the corrected project definition is this:

<project name="buildDocArchive" default="copyIt" basedir=".">

Thank you for the quick help.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
Suggested Courses

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question