title: IntelliJ is unable to import hamcrest library
body: <p>I'm having some trouble importing my project from <strong>build.gradle</strong> file.
  It's not able to find classes from <strong>hamcrest-core-1.3.jar</strong>.</p>
  
  <pre><code>gradle clean build
  </code></pre>
  
  <p>runs successfully on terminal.</p>
  
  <p>My environment is</p>
  
  <pre><code>Intellij 2016.3.1
  Gradle 2.14.1
  </code></pre>
  
  <p>It was able to resolve the reference one time but it went away on restart. When it was able to resolve hamcrest, it later failed to resolve pigunit jar. I got <strong>NoSuchMethodError</strong> (class was loaded from wrong jar) also once. </p>
  
  <p><strong>Invalidate Cache</strong> also didn't work.
  I tried importing the project from scratch multiple times.
  Please let me know if any other information is needed.</p>
  
  <p>For some reason <em>org.hamcrest.CoreMatchers</em> loads CoreMatchers from 
  <strong>mockito-all-1.10.19.jar</strong> instead of <strong>hamcrest-core-1.3.jar</strong>.I played around with the order of these two jars in the modules libraries.</p>
  
  <p>Please refer to the screenshot below.
  <a href="https://i.stack.imgur.com/WbrGs.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WbrGs.png" alt="Snapshots"></a></p>