Solved

ANT ZIP Task

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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

786 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