title: Using Java Immutables generated from a different package
body: <p>I have a class in package <code>foo</code>, <code>FooImmutableCatUser</code> that wishes to use the Immutable, <code>ImmutableCat</code> object defined in package <code>bar</code>. However, I'm having issues getting <code>FooImmutableCatUser</code> in package <code>foo</code> to recognize <code>ImmutableCat</code> despite properly importing it. The import errors (unused import), and building yields the error: <code>error: cannot find symbol</code> at <code>ImmutableCat.of()</code>. </p>
  
  <p>My directory structure in <code>bar</code> looks like: </p>
  
  <pre><code>\bar
    \models
       \Cat.java
  </code></pre>
  
  <p>Cat.java is defined as</p>
  
  <pre><code>package bar.models;
  import org.immutables.value.Value;
  
  @Value.Immutable
  public interface Cat {
      String getName();
      Object getValue();
  }
  </code></pre>
  
  <p>This correctly compiles to the <code>ImmutableCat</code> object. </p>
  
  <p>I try to access this in <code>FooImmutableCatUser</code> like so: </p>
  
  <p><code>ImmutableCat.of("myString", myObject)</code>. </p>
  
  <p>However, this throws the <code>error: cannot find symbol</code> above from both IntelliJ and Gradle. </p>
  
  <p>I'm pretty sure I've seen code that uses Immutables from other packages before. How do you get gradle or IntelliJ to recognize Immutables from other packages while building? Is there a package dependency I need to list somewhere? </p>
  
  <p>Edit: I have already tried enabling annotations with intellij via the <a href="https://immutables.github.io/apt.html" rel="nofollow noreferrer">APT instructions from Immutable</a>. I've followed those instructions to the letter, but Immutables are still not recognized, possibly due to gradle and Intellij specifying different build output directories. Maybe that is the issue--I'll post back here if resolving that is actually the solution. </p>