title: Classpath Not Recognized in Gradle Project
body: <p>I have a project branch here that shows my issue:</p>
  
  <p><a href="https://github.com/testerstories/lucid-core/tree/feature/build-full-archive" rel="nofollow">https://github.com/testerstories/lucid-core/tree/feature/build-full-archive</a></p>
  
  <p>Specifically, if I run <code>gradle build</code>, then when the <code>:lucid-junit:compileJava</code> task runs, I get a series of errors like this on my only class (<code>LucidRunner</code>) in <code>src/main/java/com/lucidtester/junit/runners</code>:</p>
  
  <pre><code>package org.junit.runner.notification does not exist
  import org.junit.runner.notification.RunNotifier;
  
  package org.junit.runners does not exist
  import org.junit.runners.BlockJUnit4ClassRunner;
                      ^
  package org.junit.runners.model does not exist
  import org.junit.runners.model.FrameworkMethod;
                            ^
  package org.junit.runners.model does not exist
  import org.junit.runners.model.InitializationError;
  </code></pre>
  
  <p>That would seem to imply that JUnit is not being recognized. But in IntelliJ, I have added JUnit to the classpath and the editor is certainly able to autocomplete aspects of JUnit. Further, in External Libraries tree under the Project Explorer, I see that JUnit4 is listed as a library.</p>
  
  <p>The same thing happens if I restrict the build to the particular module, by running this command:</p>
  
  <p><code>gradle :lucid-junit:build</code></p>
  
  <p>At this point, I have absolutely no idea what the problem is. I only have a minimal class and my build file (in the module) is putting in the correct dependency (for junit). Further, I'm using <code>subprojects</code> in the main <code>build.gradle</code> file.</p>
  
  <p>I'm not sure what else to check at this point. Nothing in the IDE indicates errors. Nothing in my Gradle build files seem to be generating errors. But it seems like something about how the build lifecycle is executing is not recognizing my classpath.</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Found something interesting. If I change my build file at all, IntelliJ refreshes everything. I then find that my External Libraries no longer show JUnit4. Then the LucidRunner.java file all the sudden springs up with a series of errors about JUnit.</p>
  
  <p>So I Option+Enter and select "Add JUnit4 to Classpath".</p>
  
  <p>That adds JUnit4 back to External Libraries and my errors disappear.</p>
  
  <p>But the <code>gradle build</code> command still shows the same error. If I change the build file again, same situation.</p>
  
  <p>I have tried what seems to be the "reboot" answer for IntelliJ: invalidate caches and restart, but that has no effect.</p>