in src/main/java/org/apache/maven/plugins/shade/pom/MavenJDOMWriter.java [177:210]
protected Element findAndReplaceSimpleLists(
Counter counter, Element parent, Collection<String> list, String parentName, String childName) {
boolean shouldExist = list != null && list.size() > 0;
Element element = updateElement(counter, parent, parentName, shouldExist);
if (shouldExist) {
Iterator<Element> elIt =
element.getChildren(childName, element.getNamespace()).iterator();
if (!elIt.hasNext()) {
elIt = null;
}
Counter innerCount = new Counter(counter.getDepth() + 1);
for (String value : list) {
Element el;
if (elIt != null && elIt.hasNext()) {
el = elIt.next();
if (!elIt.hasNext()) {
elIt = null;
}
} else {
el = factory.element(childName, element.getNamespace());
insertAtPreferredLocation(element, el, innerCount);
}
el.setText(value);
innerCount.increaseCount();
}
if (elIt != null) {
while (elIt.hasNext()) {
elIt.next();
elIt.remove();
}
}
}
return element;
}