title: Best strategy for dealing with optional dependencies
body: <p>I'm currently in the process of removing the Spring dependency from <a href="http://flywaydb.org">Flyway</a>. In the future though other types of dependencies might be needed to support a subset of users (such as JBoss VFS support).</p>
  
  <p>Which is the <strong>best way to support optional dependencies</strong> (optional=true in Maven POM)?</p>
  
  <p>Qualities of the solution would be:</p>
  
  <ul>
  <li>Ease of use for end-users (minimum work required to use functionality if dependency is present)</li>
  <li>Ease of use for developers (code dealing with optional dependency should be as readable and as straightforward as possible)</li>
  <li>No unnecessary required dependencies (if some end-user don't need this functionality, no need to pull in the dependency)</li>
  </ul>