diff --git a/src/main/org/apache/tools/ant/taskdefs/Zip.java b/src/main/org/apache/tools/ant/taskdefs/Zip.java index 98b00cc4a..3fb60a872 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Zip.java +++ b/src/main/org/apache/tools/ant/taskdefs/Zip.java @@ -92,8 +92,6 @@ public class Zip extends MatchingTask { } public void execute() throws BuildException { - project.log("Building "+ archiveType +": "+ zipFile.getAbsolutePath()); - if (baseDir == null) { throw new BuildException("basedir attribute must be set!"); } @@ -106,6 +104,16 @@ public class Zip extends MatchingTask { String[] files = ds.getIncludedFiles(); String[] dirs = ds.getIncludedDirectories(); + // quick exit if the target is up to date + boolean upToDate = true; + for (int i=0; i + zipFile.lastModified()) + upToDate = false; + if (upToDate) return; + + project.log("Building "+ archiveType +": "+ zipFile.getAbsolutePath()); + try { ZipOutputStream zOut = new ZipOutputStream(new FileOutputStream(zipFile)); initZipOutputStream(zOut);