title: Using & checking Android Support Annotations with Maven or Eclipse (without Android Studio)
body: <p>I would like to make use of a few the helpful annotations offered by Google's Android support-annotations library (<a href="http://tools.android.com/tech-docs/support-annotations" rel="nofollow">http://tools.android.com/tech-docs/support-annotations</a>) in a Java/Maven project.
  I want the annotations to be verified at compile time using <code>mvn</code> or Eclipse, without resorting to Android Studio.
  Is this possible at all?</p>
  
  <p>I my <code>pom.xml</code> I've put the following:</p>
  
  <pre><code>    &lt;dependency&gt;
          &lt;groupId&gt;com.android.support&lt;/groupId&gt;
          &lt;artifactId&gt;support-annotations&lt;/artifactId&gt;
          &lt;version&gt;23.0.0&lt;/version&gt;
          &lt;scope&gt;provided&lt;/scope&gt;
      &lt;/dependency&gt;
  </code></pre>
  
  <p>I am currently not using the <code>android-maven-plugin</code> as it is just a simple jar which doesn't rely on other Android libraries. Declaring the dependency allows me to use the annotations in my code. For example:</p>
  
  <pre><code>import android.support.annotation.CallSuper;
  import android.support.annotation.NonNull;
  
  public class TestAnnot
  {
  
      @CallSuper
      public void blah() { }
  
      public void bleh(@NotNull String str) { }
  
  }
  </code></pre>
  
  <p>This compiles fine in both Eclipse and through <code>mvn</code>. However, clear violations of the annotation's rules aren't being flagged by either. For example, nothing is currently stopping me from doing this:</p>
  
  <pre><code>public class SubTestAnnot
  {
      @Overrides
      public void blah()
      {
          // not calling super.blah() even though I should
          bleh(null); // calling bleh(String) with null even though that's not allowed
      }
  
  }
  </code></pre>
  
  <p>I've had a look at the source code of said library (look in <code>&lt;Android SDK path&gt;/extras/android/m2repository/com/android/support/support-annotations/23.0.0</code>) but it seems it only declares the annotations themselves but doesn't have code to verify them. So I'm assuming Google has implemented that separately, perhaps in one of the SDK components?</p>
  
  <p>So, does anyone know how I can configure Maven and/or eclipse to actually check these annotations?</p>