title: Why does a dependency with scope "provided" hide transitive dependencies in Maven?
body: <p>I have three modules in my Maven project (this is slightly simplified):</p>
  
  <ul>
  <li><em>model</em> contains JPA annotated entity classes</li>
  <li><em>persistence</em> instantiates an <em>EntityManager</em> and calls methods on it</li>
  <li><em>application</em> creates instances of the classes in <em>model</em>, sets some values and passes them to <em>persistence</em></li>
  </ul>
  
  <p><em>model</em> and <em>persistence</em> obviously depend on <code>javax.persistence</code>, but <em>application</em> shouldn't, I think.</p>
  
  <p>The <code>javax.persistence</code> dependency is moved to a top-level POM's <code>dependencyManagement</code> section because it occurs in a number of submodules where I only reference that entry.</p>
  
  <p>What's surprising to me is that I have to reference the dependency in <code>application</code> when I set its scope to <code>provided</code>, whereas I don't have to when its scope is <code>compile</code>.</p>
  
  <p>With a scope of <code>provided</code>, if I don't list it in the <code>dependencies</code> for <em>application</em>, the build fails with an error message from javac:</p>
  
  <blockquote>
    <p>com.sun.tools.javac.code.Symbol$CompletionFailure: class file for javax.persistence.InheritanceType not found</p>
  </blockquote>
  
  <p>What's going on?</p>