Solved

ANT ZIP Task

Posted on 2006-11-08
3
2,176 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
  • 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

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

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

Suggested Solutions

For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

821 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