title: Building project with android annotations via Maven
body: <p>I try to make my project with Android annotations build with Maven.
  Here is my build section:</p>
  
  <pre><code>&lt;build&gt;
      &lt;finalName&gt;${project.artifactId}-${project.version}&lt;/finalName&gt;
      &lt;sourceDirectory&gt;src&lt;/sourceDirectory&gt;
      &lt;resources&gt;
          &lt;resource&gt;
              &lt;directory&gt;${project.basedir}&lt;/directory&gt;
              &lt;filtering&gt;true&lt;/filtering&gt;
              &lt;targetPath&gt;${project.build.directory}/filtered-manifest&lt;/targetPath&gt;
              &lt;includes&gt;
                  &lt;include&gt;AndroidManifest.xml&lt;/include&gt;
              &lt;/includes&gt;
          &lt;/resource&gt;
      &lt;/resources&gt;
      &lt;plugins&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
              &lt;artifactId&gt;build-helper-maven-plugin&lt;/artifactId&gt;
              &lt;executions&gt;
                  &lt;execution&gt;
                      &lt;id&gt;parse-version&lt;/id&gt;
                      &lt;goals&gt;
                          &lt;goal&gt;parse-version&lt;/goal&gt;
                      &lt;/goals&gt;
                  &lt;/execution&gt;
              &lt;/executions&gt;
          &lt;/plugin&gt;
          &lt;plugin&gt;
              &lt;artifactId&gt;maven-resources-plugin&lt;/artifactId&gt;
              &lt;version&gt;2.5&lt;/version&gt;
              &lt;executions&gt;
                  &lt;execution&gt;
                      &lt;phase&gt;initialize&lt;/phase&gt;
                      &lt;goals&gt;
                          &lt;goal&gt;resources&lt;/goal&gt;
                      &lt;/goals&gt;
                  &lt;/execution&gt;
              &lt;/executions&gt;
          &lt;/plugin&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;com.jayway.maven.plugins.android.generation2&lt;/groupId&gt;
              &lt;artifactId&gt;android-maven-plugin&lt;/artifactId&gt;
              &lt;version&gt;3.2.0&lt;/version&gt;
              &lt;extensions&gt;true&lt;/extensions&gt;
              &lt;configuration&gt;
                  &lt;assetsDirectory&gt;assets&lt;/assetsDirectory&gt;
                  &lt;resourceDirectory&gt;res&lt;/resourceDirectory&gt;
                  &lt;sdk&gt;
                      &lt;path&gt;${env.ANDROID_HOME}&lt;/path&gt;
                      &lt;platform&gt;15&lt;/platform&gt;
                  &lt;/sdk&gt;
                  &lt;undeployBeforeDeploy&gt;true&lt;/undeployBeforeDeploy&gt;
                  &lt;sign&gt;
                      &lt;debug&gt;false&lt;/debug&gt;
                  &lt;/sign&gt;
                  &lt;androidManifestFile&gt;${project.build.directory}/filtered-manifest/AndroidManifest.xml&lt;/androidManifestFile&gt;
              &lt;/configuration&gt;
  
              &lt;executions&gt;
                  &lt;execution&gt;
                      &lt;id&gt;update-manifest&lt;/id&gt;
                      &lt;goals&gt;
                        &lt;goal&gt;manifest-update&lt;/goal&gt;
                      &lt;/goals&gt;
                      &lt;configuration&gt;
                        &lt;manifest&gt;
                          &lt;versionName&gt;${project.version}&lt;/versionName&gt;
                          &lt;debuggable&gt;${androidmanifest.debuggable}&lt;/debuggable&gt;
                          &lt;versionCode&gt;${parsedVersion.incrementalVersion}&lt;/versionCode&gt;
                        &lt;/manifest&gt;
                      &lt;/configuration&gt;
                  &lt;/execution&gt;
              &lt;/executions&gt;
          &lt;/plugin&gt;
          &lt;plugin&gt;
              &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
              &lt;version&gt;2.3.2&lt;/version&gt;
              &lt;configuration&gt;
                  &lt;source&gt;1.6&lt;/source&gt;
                  &lt;target&gt;1.6&lt;/target&gt;
                  &lt;includes&gt;
                      &lt;include&gt;${project.basedir}/target/generated-sources/**&lt;/include&gt;
                  &lt;/includes&gt;
              &lt;/configuration&gt;
              &lt;extensions&gt;true&lt;/extensions&gt;
          &lt;/plugin&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;org.bsc.maven&lt;/groupId&gt;
              &lt;artifactId&gt;maven-processor-plugin&lt;/artifactId&gt;
              &lt;version&gt;2.0.5&lt;/version&gt;
              &lt;executions&gt;
                  &lt;execution&gt;
                      &lt;id&gt;process&lt;/id&gt;
                      &lt;goals&gt;
                          &lt;goal&gt;process&lt;/goal&gt;
                      &lt;/goals&gt;
                      &lt;phase&gt;generate-sources&lt;/phase&gt;
                      &lt;configuration&gt;
                          &lt;processors&gt;
                              &lt;processor&gt;com.googlecode.androidannotations.AndroidAnnotationProcessor&lt;/processor&gt;
                          &lt;/processors&gt;
                      &lt;/configuration&gt;
                  &lt;/execution&gt;
              &lt;/executions&gt;
              &lt;dependencies/&gt;
          &lt;/plugin&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
              &lt;artifactId&gt;maven-jarsigner-plugin&lt;/artifactId&gt;
              &lt;version&gt;1.2&lt;/version&gt;
              &lt;executions&gt;
                  &lt;execution&gt;
                      &lt;id&gt;signing&lt;/id&gt;
                      &lt;goals&gt;
                          &lt;goal&gt;sign&lt;/goal&gt;
                          &lt;goal&gt;verify&lt;/goal&gt;
                      &lt;/goals&gt;
                      &lt;phase&gt;package&lt;/phase&gt;
                      &lt;inherited&gt;true&lt;/inherited&gt;
                      &lt;configuration&gt;
                          &lt;removeExistingSignatures&gt;true&lt;/removeExistingSignatures&gt;
                          &lt;archiveDirectory /&gt;
                          &lt;includes&gt;
                              &lt;include&gt;${project.build.directory}/${project.artifactId}-${version}.apk&lt;/include&gt;
                          &lt;/includes&gt;
                          &lt;keystore&gt;${basedir}/certificate/release-key.keystore&lt;/keystore&gt;
                          &lt;alias&gt;&lt;/alias&gt;
                          &lt;storepass&gt;&lt;/storepass&gt;
                          &lt;verbose&gt;false&lt;/verbose&gt;
                      &lt;/configuration&gt;
                  &lt;/execution&gt;
              &lt;/executions&gt;
          &lt;/plugin&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
              &lt;artifactId&gt;maven-release-plugin&lt;/artifactId&gt;
              &lt;version&gt;2.1&lt;/version&gt;
              &lt;configuration&gt;
                  &lt;tagBase&gt;scm:git:${staging.git.repo.url}&lt;/tagBase&gt;
                  &lt;scmCommentPrefix&gt;release:&lt;/scmCommentPrefix&gt;
                  &lt;preparationGoals&gt;clean install&lt;/preparationGoals&gt;
                  &lt;arguments&gt;-Dstaging.git.repo.url=${staging.git.repo.url}&lt;/arguments&gt;
                  &lt;checkModificationExcludes&gt;
                      &lt;checkModificationExclude&gt;.gitignore&lt;/checkModificationExclude&gt;
                      &lt;checkModificationExclude&gt;.classpath&lt;/checkModificationExclude&gt;
                      &lt;checkModificationExclude&gt;.project&lt;/checkModificationExclude&gt;
                      &lt;checkModificationExclude&gt;.settings&lt;/checkModificationExclude&gt;
                      &lt;checkModificationExclude&gt;**.iml&lt;/checkModificationExclude&gt;
                      &lt;checkModificationExclude&gt;.idea**&lt;/checkModificationExclude&gt;
                      &lt;checkModificationExclude&gt;project.properties&lt;/checkModificationExclude&gt;
                      &lt;checkModificationExclude&gt;default.properties&lt;/checkModificationExclude&gt;
                  &lt;/checkModificationExcludes&gt;
              &lt;/configuration&gt;
          &lt;/plugin&gt;
      &lt;/plugins&gt;
  &lt;/build&gt;
  </code></pre>
  
  <p>Here is a piece of build log I got:</p>
  
  <pre><code>[INFO] ------------------------------------------------------------------------
  [INFO] Building SomeApp 1.03.15-SNAPSHOT
  [INFO] ------------------------------------------------------------------------
  [INFO] 
  [INFO] --- build-helper-maven-plugin:1.7:parse-version (parse-version) @ SomeApp ---
  [INFO] 
  [INFO] --- maven-resources-plugin:2.5:resources (default) @ SomeApp ---
  [debug] execute contextualize
  [INFO] Using 'utf-8' encoding to copy filtered resources.
  [INFO] Copying 1 resource to /Users/darja/Works/someapp/Android/target/filtered-manifest
  [INFO] 
  [INFO] --- android-maven-plugin:3.2.0:generate-sources (default-generate-sources) @ SomeApp ---
  [INFO] ANDROID-904-002: Found aidl files: Count = 0
  [INFO] ANDROID-904-002: Found aidl files: Count = 0
  [INFO] /Users/darja/Development/sdk/platform-tools/aapt [package, -m, -J, /Users/darja/Works/someapp/Android/target/generated-sources/r, -M, /Users/darja/Works/someapp/Android/target/filtered-manifest/AndroidManifest.xml, -S, /Users/darja/Works/someapp/Android/res, --auto-add-overlay, -A, /Users/darja/Works/someapp/Android/assets, -I, /Users/darja/Development/sdk/platforms/android-15/android.jar]
  [INFO] 
  [INFO] --- maven-processor-plugin:2.0.5:process (process) @ Someapp ---
  [INFO] Source directory: /Users/darja/Works/someapp/Android/target/generated-sources/apt added
  [INFO] javac option: -cp
  [INFO] javac option: /Users/darja/.m2/repository/org/sonatype/sisu/sisu-inject-bean/1.4.3.1/sisu-inject-bean-1.4.3.1.jar:/Users/darja/.m2/repository/org/sonatype/sisu/sisu-guice/2.9.1/sisu-guice-2.9.1-noaop.jar:/Users/darja/.m2/repository/org/sonatype/aether/aether-util/1.8/aether-util-1.8.jar:/Users/darja/.m2/repository/org/codehaus/plexus/plexus-interpolation/1.14/plexus-interpolation-1.14.jar:/Users/darja/.m2/repository/org/codehaus/plexus/plexus-utils/2.0.4/plexus-utils-2.0.4.jar:/Users/darja/.m2/repository/org/codehaus/plexus/plexus-component-annotations/1.5.5/plexus-component-annotations-1.5.5.jar:/Users/darja/.m2/repository/org/sonatype/plexus/plexus-sec-dispatcher/1.3/plexus-sec-dispatcher-1.3.jar:/Users/darja/.m2/repository/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar:/Users/darja/Works/someapp/Android:/Users/darja/Works/someapp/Android/target/generated-sources/extracted-dependencies/src/main/resources:/Users/darja/Works/someapp/Android/target/classes:/Users/darja/.m2/repository/com/google/android/android/4.0.1.2/android-4.0.1.2.jar:/Users/darja/.m2/repository/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar:/Users/darja/.m2/repository/org/apache/httpcomponents/httpclient/4.0.1/httpclient-4.0.1.jar:/Users/darja/.m2/repository/org/apache/httpcomponents/httpcore/4.0.1/httpcore-4.0.1.jar:/Users/darja/.m2/repository/commons-codec/commons-codec/1.3/commons-codec-1.3.jar:/Users/darja/.m2/repository/org/khronos/opengl-api/gl1.1-android-2.1_r1/opengl-api-gl1.1-android-2.1_r1.jar:/Users/darja/.m2/repository/xerces/xmlParserAPIs/2.6.2/xmlParserAPIs-2.6.2.jar:/Users/darja/.m2/repository/xpp3/xpp3/1.1.4c/xpp3-1.1.4c.jar:/Users/darja/.m2/repository/org/json/json/20080701/json-20080701.jar:/Users/darja/.m2/repository/com/bugsense/BugSense/3.0.7/BugSense-3.0.7.jar:/Users/darja/.m2/repository/com/googlecode/androidannotations/androidannotations/2.6/androidannotations-2.6.jar:/Users/darja/.m2/repository/com/googlecode/androidannotations/androidannotations/2.6/androidannotations-2.6-api.jar:/Users/darja/.m2/repository/com/google/gcm/gcm/1.0.2/gcm-1.0.2.jar:/Users/darja/.m2/repository/joda-time/joda-time/2.1/joda-time-2.1.jar:
  [INFO] javac option: -proc:only
  [INFO] javac option: -processor
  [INFO] javac option: com.googlecode.androidannotations.AndroidAnnotationProcessor
  [INFO] javac option: -d
  [INFO] javac option: /Users/darja/Works/someapp/Android/target/classes
  [INFO] javac option: -s
  [INFO] javac option: /Users/darja/Works/someapp/Android/target/generated-sources/apt
  [INFO] diagnostic /Users/darja/Works/someapp/Android/src/com/someapp/social/facebook/FbDialog.java:37: cannot find symbol
  symbol  : class R
  location: package com.someapp
  
  ...Many complains about cannot find class R...
  
  [INFO] diagnostic /Users/darja/Works/someapp/Android/src/com/someapp/ui/views/SearchView.java:47: package R does not exist
  [INFO] diagnostic Note: Starting AndroidAnnotations annotation processing
  [INFO] diagnostic Note: Dummy source file: file:///Users/darja/Works/someapp/Android/target/generated-sources/apt/dummy1358938267097.java
  [INFO] diagnostic Note: AndroidManifest.xml file found: /Users/darja/Works/someapp/Android/AndroidManifest.xml
  [INFO] diagnostic warning: The AndroidManifest.xml file was found, but not the compiled R class: com.someapp.R
  [INFO] diagnostic error: Unexpected error. Please report an issue on AndroidAnnotations, with the following content: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
      at com.googlecode.androidannotations.helper.TargetAnnotationHelper.extractAnnotationValue(TargetAnnotationHelper.java:52)
      at com.googlecode.androidannotations.helper.TargetAnnotationHelper.extractAnnotationValue(TargetAnnotationHelper.java:40)
      at com.googlecode.androidannotations.helper.IdValidatorHelper.idExists(IdValidatorHelper.java:47)
      at com.googlecode.androidannotations.helper.IdValidatorHelper.idExists(IdValidatorHelper.java:42)
      at com.googlecode.androidannotations.validation.EActivityValidator.validate(EActivityValidator.java:54)
      at com.googlecode.androidannotations.validation.ModelValidator.validate(ModelValidator.java:53)
      at com.googlecode.androidannotations.AndroidAnnotationProcessor.validateAnnotations(AndroidAnnotationProcessor.java:389)
      at com.googlecode.androidannotations.AndroidAnnotationProcessor.processThrowing(AndroidAnnotationProcessor.java:341)
      at com.googlecode.androidannotations.AndroidAnnotationProcessor.process(AndroidAnnotationProcessor.java:318)
      at com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:627)
      at com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(JavacProcessingEnvironment.java:556)
      at com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:701)
      at com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:987)
      at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:727)
      at com.sun.tools.javac.main.Main.compile(Main.java:353)
      at com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:115)
      at org.bsc.maven.plugin.processor.AbstractAnnotationProcessorMojo.executeWithExceptionsHandled(AbstractAnnotationProcessorMojo.java:350)
      at org.bsc.maven.plugin.processor.AbstractAnnotationProcessorMojo.execute(AbstractAnnotationProcessorMojo.java:197)
      at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
      at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
      at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
      at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
      at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
      at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
      at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
      at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
      at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
      at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
      at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
      at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
      at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
  Caused by: java.lang.reflect.InvocationTargetException
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at com.googlecode.androidannotations.helper.TargetAnnotationHelper.extractAnnotationValue(TargetAnnotationHelper.java:50)
      ... 38 more
  Caused by: java.lang.annotation.AnnotationTypeMismatchException: Incorrectly typed data found for annotation element public abstract int com.googlecode.androidannotations.annotations.EActivity.value() (Found data of type int)
      at com.sun.tools.javac.model.AnnotationProxyMaker$ValueVisitor$1.generateException(AnnotationProxyMaker.java:243)
      at sun.reflect.annotation.AnnotationInvocationHandler.invoke(AnnotationInvocationHandler.java:57)
      at $Proxy16.value(Unknown Source)
      ... 43 more
  </code></pre>
  
  <p>But I see that <code>R.java</code> was generated in <code>target/generated-source/r/com/someapp</code> (package name is <code>com.someapp</code>) What I am doing wrong?</p>
  
  <p>May be someone have working Maven script for Android annotations project and can share it?</p>