diff --git a/WHATSNEW b/WHATSNEW index 31b0ed743..1ee15e205 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -39,6 +39,10 @@ Changes that could break older environments: defined in the project. If you rely on the task waiting for input, don't use the addproperty attribute. +* The Class-Path attribute in manifests will no longer merge the + entries of all manifests found, but will be treated like all other + manifest attributes - the most recent attribute(s) will be used. + Fixed bugs: ----------- * Filter readers were not handling line endings properly. Bugzilla @@ -182,6 +186,9 @@ Fixed bugs: * Nested websphere element for ejbjar does not support spaces in file name. Bugzilla Report 21298 +* Don't multiply Class-Path attributes when updating jars. Bugzilla + Report 21170. + Other changes: -------------- * Six new Clearcase tasks added. diff --git a/src/main/org/apache/tools/ant/taskdefs/Manifest.java b/src/main/org/apache/tools/ant/taskdefs/Manifest.java index 6f9dcc3ea..703c1f46f 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Manifest.java +++ b/src/main/org/apache/tools/ant/taskdefs/Manifest.java @@ -459,16 +459,19 @@ public class Manifest { } Enumeration e = section.getAttributeKeys(); + Attribute classpathAttribute = null; while (e.hasMoreElements()) { String attributeName = (String) e.nextElement(); Attribute attribute = section.getAttribute(attributeName); - if (attributeName.equals(ATTRIBUTE_CLASSPATH) && - attributes.containsKey(attributeName)) { - Attribute ourClassPath = getAttribute(attributeName); + if (attributeName.equals(ATTRIBUTE_CLASSPATH)) { + if (classpathAttribute == null) { + classpathAttribute = new Attribute(); + classpathAttribute.setName(ATTRIBUTE_CLASSPATH); + } Enumeration cpe = attribute.getValues(); while (cpe.hasMoreElements()) { String value = (String) cpe.nextElement(); - ourClassPath.addValue(value); + classpathAttribute.addValue(value); } } else { // the merge file always wins @@ -476,6 +479,11 @@ public class Manifest { } } + if (classpathAttribute != null) { + // the merge file *always* wins, even for Class-Path + storeAttribute(classpathAttribute); + } + // add in the warnings Enumeration warnEnum = section.warnings.elements(); while (warnEnum.hasMoreElements()) {