388541 : retain existing classpath attributes on update
Change-Id: I26857021b03e159be28ab925985da9f500ccb6ed
Signed-off-by: Fred Bricon <fbricon@gmail.com>
diff --git a/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/ClasspathDescriptor.java b/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/ClasspathDescriptor.java
index 5a0f0eb..17c4ce3 100644
--- a/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/ClasspathDescriptor.java
+++ b/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/ClasspathDescriptor.java
@@ -17,6 +17,7 @@
import java.util.List;
import java.util.ListIterator;
import java.util.Map;
+import java.util.Map.Entry;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
@@ -117,6 +118,14 @@
descriptor.setOutputLocation(outputLocation);
descriptor.setInclusionPatterns(inclusion);
descriptor.setExclusionPatterns(exclusion);
+
+ //Bug 388541: preserve existing classpath attributes
+ IClasspathEntryDescriptor oldEntry = staleEntries.get(sourcePath);
+ if(oldEntry != null) {
+ for(Entry<String, String> entry : oldEntry.getClasspathAttributes().entrySet()) {
+ descriptor.setClasspathAttribute(entry.getKey(), entry.getValue());
+ }
+ }
if(generated) {
descriptor.setClasspathAttribute(IClasspathAttribute.OPTIONAL, "true"); //$NON-NLS-1$
}