title: Maven dependency within dependency with different scope
body: <p>Say I have two Maven dependencies defined in a project like below.</p>
  
  <pre><code>    &lt;dependency&gt;
          &lt;groupId&gt;com.thoughtworks.xstream&lt;/groupId&gt;
          &lt;artifactId&gt;xstream&lt;/artifactId&gt;
          &lt;version&gt;1.3.1&lt;/version&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;mycompany.library&lt;/groupId&gt;
          &lt;artifactId&gt;mylibrary&lt;/artifactId&gt;
          &lt;version&gt;1.0.1&lt;/version&gt;
          &lt;scope&gt;compile&lt;/scope&gt;
      &lt;/dependency&gt;
  </code></pre>
  
  <p>Then, within mylibrary, I also have a dependency defined as below.</p>
  
  <pre><code>    &lt;dependency&gt;
          &lt;groupId&gt;com.thoughtworks.xstream&lt;/groupId&gt;
          &lt;artifactId&gt;xstream&lt;/artifactId&gt;
          &lt;version&gt;1.3.1&lt;/version&gt;
          &lt;scope&gt;compile&lt;/scope&gt;
      &lt;/dependency&gt;
  </code></pre>
  
  <p>When I package my project, I don't see xstream packaged within it. I think the project's xstream dependency scope, 'test' is overriding the mylibrary's xstream dependency scope, 'compile'.</p>
  
  <p>In this kind of situation, what's the best way to include the xstream for the whole project so the submodule can have access to it when packaged within the project?</p>
  
  <p>I've read Apache Maven website's explanation on Transitive dependencies, but I'm struggling to understand what it means, and also to find out the best practice in this situation.</p>