title: Handling changes in dependent 3rd party libraries
body: <p>I have a project which depends on several 3rd party libraries, the project itself is packaged as a jar and distributed to other developers as a library.
  Those developers add the dependencies to their classpath and use my library in their code.</p>
  
  <p>Recently I had an issue with one of the 3rd party dependencies, the apache commons codec libary,
  The problem is this:</p>
  
  <pre><code>byte[] arr = "hi".getBytes();
  // Codec Version 1.4
  Base64.encodeBase64String(arr) == "aGk=\r\n" // this is true
  
  // Codec Version 1.6
  Base64.encodeBase64String(arr) == "aGk=" // this is true
  </code></pre>
  
  <p>As you can see the output of the method has changed with the minor version bump.</p>
  
  <p>My question is, I don't want to force the user of my library to a specific minor version of a 3rd party library. Assuming I know about the change to the dependent library, is there anyway in which I can recognize which library version is being included in the classpath and behave accordingly? or alternatively, what is considered to be the best practice for these kind of scenarios?</p>
  
  <p>P.S - I know that for the above example I can just use <code>new String(Base64.encodeBase64(data, false))</code> which is backwards compatible, this is a more general question.</p>