diff --git a/WHATSNEW b/WHATSNEW index 0213e6a4c..4a2760cee 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -139,6 +139,9 @@ Fixed bugs: * 's uptodate test works even if outputdirectory is not the parent dir of target +* will remove target file (if it exists) before writing to it - + this avoids problems with links on filesystems that support them. + Changes from Ant 1.2 to Ant 1.3 =========================================== diff --git a/src/main/org/apache/tools/ant/Project.java b/src/main/org/apache/tools/ant/Project.java index 5651626f2..d4892b4d3 100644 --- a/src/main/org/apache/tools/ant/Project.java +++ b/src/main/org/apache/tools/ant/Project.java @@ -752,8 +752,13 @@ public class Project { boolean overwrite, boolean preserveLastModified) throws IOException { - if (overwrite || + if (overwrite || !destFile.exists() || destFile.lastModified() < sourceFile.lastModified()) { + + if (destFile.exists()) { + destFile.delete(); + } + log("Copy: " + sourceFile.getAbsolutePath() + " -> " + destFile.getAbsolutePath(), MSG_VERBOSE);