title: Two versions of library dependency in Maven
body: <p>In my <code>pom.xml</code> I have </p>
  
  <pre><code>&lt;dependency&gt;
      &lt;groupId&gt;org.json&lt;/groupId&gt;
      &lt;artifactId&gt;json&lt;/artifactId&gt;
      &lt;version&gt;20170516&lt;/version&gt;
  &lt;/dependency&gt;
  </code></pre>
  
  <p>And my Program needs and uses this version om JSON.</p>
  
  <pre><code>import org.json.JSONObject;
  </code></pre>
  
  <p>When I put in</p>
  
  <pre><code>final JsonObject jsonObject = new JsonObject();
  System.out.println( jsonObject.getClass().getPackage().getImplementationVersion());
  </code></pre>
  
  <p>I get </p>
  
  <pre><code>20170516
  </code></pre>
  
  <p>Okay, alright. (Note: This is a class of the program, not the test!)</p>
  
  <p>Now I run my Unittest (Mockito, JUnit) with <code>mvn test</code>. I get an error, which is related to the JSONObject version. And the log says:</p>
  
  <pre><code>0.0.20131108.vaadin1
  </code></pre>
  
  <p>I found out, that this version comes from this dependency</p>
  
  <pre><code>&lt;dependency&gt;
      &lt;groupId&gt;org.skyscreamer&lt;/groupId&gt;
      &lt;artifactId&gt;jsonassert&lt;/artifactId&gt;
      &lt;version&gt;1.5.0&lt;/version&gt;
      &lt;scope&gt;test&lt;/scope&gt;
  &lt;/dependency&gt;
  </code></pre>
  
  <p>If I delete it, my test works fine.</p>
  
  <p>But now other tests fail, wich uses this dependency</p>
  
  <pre><code>import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
  import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
  </code></pre>
  
  <p>and in pom.xml</p>
  
  <pre><code>&lt;dependency&gt;
      &lt;groupId&gt;org.springframework&lt;/groupId&gt;
      &lt;artifactId&gt;spring-test&lt;/artifactId&gt;
      &lt;version&gt;4.3.4.RELEASE&lt;/version&gt;
  &lt;/dependency&gt;
  </code></pre>
  
  <p>How can I configure maven, that the program uses JSON version 20170516, but spring-test can still use jsonassert?</p>
  
  <p>Even if almost the sam name, I don't think this is a dublicate of 
  * <a href="https://stackoverflow.com/questions/7406604/two-versions-of-dependencies-in-maven">two versions of dependencies in maven</a></p>
  
  <p>-- Edit 1</p>
  
  <pre><code>mvn dependency:tree | grep json 
  [INFO] +- org.skyscreamer:jsonassert:jar:1.5.0:test 
  [INFO] |  \- com.vaadin.external.google:android-json:jar:0.0.20131108.vaadin1:test 
  [INFO] +- com.jayway.jsonpath:json-path-assert:jar:2.2.0:test 
  [INFO] |  +- com.jayway.jsonpath:json-path:jar:2.2.0:test 
  [INFO] |  |  \- net.minidev:json-smart:jar:2.2.1:test 
  [INFO] +- org.json:json:jar:20170516:compile
  </code></pre>