Solved

ANT ZIP Task

Posted on 2006-11-08
3
2,172 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
Comment Utility
looks fine, perhaps try:

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

Author Comment

by:paulReeves
Comment Utility
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
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
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…

744 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now