// Check for a new conflict
if (moduleRevision.state == ModuleState.New) {
ModuleResolveState module = resolveState.getModule(moduleId);
// A new module revision. Check for conflict
PotentialConflict c = conflictHandler.registerModule(module);
if (!c.conflictExists()) {
// No conflict. Select it for now
LOGGER.debug("Selecting new module version {}", moduleRevision);
module.select(moduleRevision);
} else {
// We have a conflict
LOGGER.debug("Found new conflicting module version {}", moduleRevision);
// Deselect the currently selected version, and remove all outgoing edges from the version
// This will propagate through the graph and prune configurations that are no longer required
// For each module participating in the conflict (many times there is only one participating module that has multiple versions)
c.withParticipatingModules(new Action<ModuleIdentifier>() {
public void execute(ModuleIdentifier module) {
ModuleVersionResolveState previouslySelected = resolveState.getModule(module).clearSelection();
if (previouslySelected != null) {
for (ConfigurationNode configuration : previouslySelected.configurations) {
configuration.deselect();