title: How does Maven resolve version conflicts of transitive dependencies ? nearest-wins strategy
body: <p>I just finally got used to not having any Used undeclared or Unused declared dependencies in my projects. Although it is very hard to track Unused declared runtime/test dependencies that are listed in dependency:analyze... One just must write comments to them in pom.xml or otherwise manage them to know that they are needed for testing or runtime.</p>
  
  <p>But the way of resolving version conflict is still unclear to me. Regarding transitive dependencies.</p>
  
  <p>How does the nearest-wins strategy work exactly? When is one version used over another version ? </p>
  
  <ul>
  <li><p>If you declare the Used undeclared dependency with a version number - it always wins</p></li>
  <li><p>If one doesn't specify dependency version explicitly, Maven cannot resolve any version 
  conflicts that may arise regarding this dependency (weird, but written <a href="http://www.sonatype.com/books/mvnex-book/reference/optimizing-sect-dependency-plugin.html" rel="noreferrer">here</a>)</p></li>
  <li><p>If you don't declare Undeclared used dependency, it chooses a transitive dependency from the closest level (nearest-wins strategy) and if the conflict is on the same level then it somehow decides between version A over version B ... Maybe the first one it comes to when processing the depenencies wins</p></li>
  </ul>