org.eclipse.aether.util.graph.transformer

## Class NearestVersionSelector

- java.lang.Object
- - org.eclipse.aether.util.graph.transformer.ConflictResolver.VersionSelector
  - - org.eclipse.aether.util.graph.transformer.NearestVersionSelector

-     public final class NearestVersionSelector
      extends ConflictResolver.VersionSelector

  A version selector for use with `ConflictResolver` that resolves version conflicts using a nearest-wins strategy. If there is no single node that satisfies all encountered version ranges, the selector will fail.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `NearestVersionSelector()` Creates a new instance of this version selector.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `selectVersion(ConflictResolver.ConflictContext context)` Determines the winning node among conflicting dependencies.

    - ### Methods inherited from class org.eclipse.aether.util.graph.transformer.ConflictResolver.VersionSelector

      `getInstance`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### NearestVersionSelector

          public NearestVersionSelector()

      Creates a new instance of this version selector.

  - ### Method Detail

    - #### selectVersion

          public void selectVersion(ConflictResolver.ConflictContext context)
                             throws RepositoryException

      Description copied from class: `ConflictResolver.VersionSelector`
      Determines the winning node among conflicting dependencies. Implementations will usually iterate `ConflictResolver.ConflictContext.getItems()`, inspect `ConflictResolver.ConflictItem.getNode()` and eventually call `ConflictResolver.ConflictContext.setWinner(ConflictResolver.ConflictItem)` to deliver the winner. Failure to select a winner will automatically fail the entire conflict resolution.
      Specified by:
        `selectVersion` in class `ConflictResolver.VersionSelector`
      Parameters:
        `context` - The conflict context, must not be `null`.
      Throws:
        `RepositoryException` - If the version selection failed.

Copyright © 2010-2013 The Eclipse Foundation. All Rights Reserved.