Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

ANT ZIP Task

Posted on 2006-11-08
3
Medium Priority
?
2,221 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 1500 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
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.
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
Suggested Courses

783 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