src/java/fr/jayasoft/ivy/ant/IvyBuildList.java
/**
     * Search in the moduleIdMap modules depending on node, add them to the toKeep set and process them 
     * recursively.
     *
     * @param node the node to be processed
     * @param toKeep the set of ModuleDescriptors that should be kept
     * @param moduleIdMap reference mapping of moduleId to ModuleDescriptor that are part of the BuildList
     */
Search in the moduleIdMap modules depending on node, add them to the toKeep set and process them
recursively.

@param node the node to be processed
@param toKeep the set of ModuleDescriptors that should be kept
@param moduleIdMap reference mapping of moduleId to ModuleDescriptor that are part of the BuildList
Search in the moduleIdMap modules depending on node add them to the toKeep set and process them recursively . @param node the node to be processed @param toKeep the set of ModuleDescriptors that should be kept @param moduleIdMap reference mapping of moduleId to ModuleDescriptor that are part of the BuildList
private void processFilterNodeFromLeaf(ModuleDescriptor node, Set toKeep, Map moduleIdMap) {
    	for (Iterator iter = moduleIdMap.values().iterator(); iter.hasNext();) {
			ModuleDescriptor md = (ModuleDescriptor) iter.next();
			DependencyDescriptor[] deps = md.getDependencies();
	        for (int i=0; i<deps.length; i++) {
	            ModuleId id = deps[i].getDependencyId();
	            if (node.getModuleRevisionId().getModuleId().equals(id) && !toKeep.contains(md)) {
	            	toKeep.add(md);
	            	processFilterNodeFromLeaf(md, toKeep, moduleIdMap);
	            }
	        }
		}
    }
private void processFilterNodeFromLeaf ( ModuleDescriptor node , Set toKeep , Map moduleIdMap ) { for ( Iterator iter = moduleIdMap . values ( ) . iterator ( ) ; iter . hasNext ( ) ; ) { ModuleDescriptor md = ( ModuleDescriptor ) iter . next ( ) ; DependencyDescriptor [ ] deps = md . getDependencies ( ) ; for ( int i = 0 ; i < deps . length ; i ++ ) { ModuleId id = deps [ i ] . getDependencyId ( ) ; if ( node . getModuleRevisionId ( ) . getModuleId ( ) . equals ( id ) && ! toKeep . contains ( md ) ) { toKeep . add ( md ) ; processFilterNodeFromLeaf ( md , toKeep , moduleIdMap ) ; } } } }
Search in the moduleIdMap modules depending on node, add them to the toKeep set and process them
 recursively.
Search in the moduleIdMap modules depending on node add them to the toKeep set and process them recursively .