title: IntelliJ can't find generated sources when used in same module
body: <p>I'm using annotation processors of <a href="https://github.com/google/auto/tree/master/factory" rel="noreferrer">Google's AutoFactory</a>. I annotated <code>SomeClass</code> with <code>@AutoFactory</code> and referenced <code>new SomeClassFactory().create()</code> somewhere else in that same module. </p>
  
  <h3>Maven configuration:</h3>
  
  <p>I added the necessary dependency in Maven:</p>
  
  <pre><code>    &lt;dependency&gt;
          &lt;groupId&gt;com.google.auto.factory&lt;/groupId&gt;
          &lt;artifactId&gt;auto-factory&lt;/artifactId&gt;
          &lt;version&gt;1.0-beta2&lt;/version&gt;
          &lt;optional&gt;true&lt;/optional&gt;
      &lt;/dependency&gt;
  </code></pre>
  
  <p>When running <code>$ mvn clean compile</code> I see that <code>target/generated-sources/annotions/somepackage/SomeClassFactory</code> is created and the module compiles without errors.</p>
  
  <h3>IntelliJ configuration:</h3>
  
  <ul>
  <li><code>Reimport all maven modules</code></li>
  <li><code>Preferences</code> -> <code>Annotation Processors</code> -> <code>Enable annotation processing</code></li>
  <li><code>Rebuild Project</code></li>
  </ul>
  
  <p>This should be enough in my version of IDEA (<code>v14.1.4</code>) if my understanding is correct.</p>
  
  <p><a href="https://i.stack.imgur.com/UAkCA.png" rel="noreferrer"><img src="https://i.stack.imgur.com/UAkCA.png" alt="Compiler Preferences"></a>
  <a href="https://i.stack.imgur.com/p9m5M.png" rel="noreferrer"><img src="https://i.stack.imgur.com/p9m5M.png" alt="Project Structure"></a></p>
  
  <p>I also performed the following steps:</p>
  
  <ul>
  <li>Verified that <code>generated-sources</code> folder is added as a source in <code>Project Structure</code></li>
  <li>Verified that Maven preference <code>Generated sources folders</code> is set to <code>Detect automatically</code></li>
  <li>Verified that source is actually generated upon Rebuild (deleted <code>target</code> folder first to be sure it's generated by IntelliJ)</li>
  <li>Try to disable <code>Exclude output paths</code> in Project Structure, as suggested by <a href="https://stackoverflow.com/a/19863055/741217">@tilpner</a></li>
  <li>Invalidate caches and restart</li>
  <li>Delete <code>.idea</code> folder and <code>.iml</code> files</li>
  <li>Experiment with different settings for <code>Phase to be used for folders update</code> in <code>Preferences</code> -> <code>Maven</code> -> <code>Importing</code></li>
  </ul>
  
  <h3>Problem:</h3>
  
  <p>After performing all these steps, the generated class doesn't show up in the project explorer. In fact, the entire <code>target</code> directory is nowhere to be seen. Compilation fails with <code>cannot find symbol: SomeClassFactory</code> 
  and <code>new SomeClassFactory().create()</code> is marked in red in the editor, while Maven generates and compiles without any problems.</p>
  
  <p>I'm out of options myself and any help or suggestions would be very welcome!</p>
  
  <p><strong>Update:</strong> when I comment the code that causes the compilation error, IntelliJ prints this warning in the compilation messages: <code>Warning:Output path /Users/.../target/generated-sources/annotations intersects with a source root. Only files that were created by build will be cleaned.</code></p>