title: Groovy:Apparent variable xyz was found in a static scope but doesn't refer to a local variable, static field or class. Possible causes:
body: <p>I am getting this "error" in an Spring Tool Suite for all of my domain classes.  Its not really an error, because it compiles fine.  But it's masking real compile errors, how can I get rid of it ?   They are in the same package, so I dont need the import, if I add the import it says it can't find the class...</p>
  
  <p>So the following code produce a red x</p>
  
  <blockquote>
    <p>Groovy:Apparent variable 'ExampleB' was found in a static scope but doesn't refer to a local variable, static 
     field or class. Possible causes:</p>
  </blockquote>
  
  <pre><code>package domain.com.so;
  
  class ExampleA {
      static belongsTo  = [exampleB: ExampleB]
      static constraints = {
      }
  }
  </code></pre>
  
  <hr>
  
  <p>And this code produces a simpilar error:</p>
  
  <blockquote>
    <p>Groovy:Apparent variable 'ExampleA' was found in a static scope but doesn't refer to a local variable, static field 
     or class. Possible causes:</p>
  </blockquote>
  
  <pre><code>package domain.com.so;
  
  class ExampleB {
      static hasMany  = [exampleAs: ExampleA]
      static constraints = {
      }
  }
  </code></pre>