for (Iterator i = resolvedArtifacts.values().iterator(); i.hasNext();) {
List nodes = (List) i.next();
for (Iterator j = nodes.iterator(); j.hasNext();) {
ResolutionNode node = (ResolutionNode) j.next();
Artifact artifact = node.getArtifact();
if (!node.equals(root) && node.isActive() && node.filterTrail(filter)
// If it was optional and not a direct dependency,
// we don't add it or its children, just allow the
// update of the version and scope
&& (node.isChildOfRootNode() || !artifact.isOptional())) {
artifact.setDependencyTrail(node.getDependencyTrail());