diff --git a/src/main/org/apache/tools/ant/taskdefs/Jar.java b/src/main/org/apache/tools/ant/taskdefs/Jar.java index 364cb59b4..37a30402b 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Jar.java +++ b/src/main/org/apache/tools/ant/taskdefs/Jar.java @@ -98,7 +98,7 @@ public class Jar extends Zip { InputStream in = this.getClass().getResourceAsStream(s); if ( in == null ) throw new BuildException ( "Could not find: " + s ); - zipFile(in, zOut, "META-INF/MANIFEST.MF"); + zipFile(in, zOut, "META-INF/MANIFEST.MF", System.currentTimeMillis()); } } diff --git a/src/main/org/apache/tools/ant/taskdefs/Zip.java b/src/main/org/apache/tools/ant/taskdefs/Zip.java index ab0cc4b81..1af5fc920 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Zip.java +++ b/src/main/org/apache/tools/ant/taskdefs/Zip.java @@ -161,10 +161,12 @@ public class Zip extends MatchingTask { { } - protected void zipFile(InputStream in, ZipOutputStream zOut, String vPath) + protected void zipFile(InputStream in, ZipOutputStream zOut, String vPath, + long lastModified) throws IOException { ZipEntry ze = new ZipEntry(vPath); + ze.setTime(lastModified); /* * XXX ZipOutputStream.putEntry expects the ZipEntry to know its @@ -222,7 +224,7 @@ public class Zip extends MatchingTask { throws IOException { FileInputStream fIn = new FileInputStream(file); - zipFile(fIn, zOut, vPath); + zipFile(fIn, zOut, vPath, file.lastModified()); fIn.close(); } }