title: Setting the generated source directory for annotation processors in Maven
body: <p>I'm trying to move a build which generates sources using an annotation processor to Maven. I've tried configuring the maven-compiler-plugin as follows:</p>
  
  <pre><code>    &lt;plugins&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
              &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
              &lt;configuration&gt;
                  &lt;fork&gt;true&lt;/fork&gt;
                  &lt;compilerArgument&gt;-s ${project.build.directory}/target/generated-sources/annotation-processing&lt;/compilerArgument&gt;
              &lt;/configuration&gt;
          &lt;/plugin&gt;
      &lt;/plugins&gt;
  </code></pre>
  
  <p>But javac fails with </p>
  
  <pre><code>[INFO] Compilation failure  
  Failure executing javac,  but could not parse the error:
  javac: invalid flag: -s /home/robert/workspaces/betbrain/sportsengine.common/sportsengine.bean.test/target/target/generated-sources/annotation-processing  
  Usage: javac &lt;options&gt; &lt;source files&gt;  
  use -help for a list of possible options
  </code></pre>
  
  <p>As far as I can tell, -s should be passed before the source files to javac, but maven passes it after.</p>
  
  <p>How can I pass the <code>-s</code> flag properly to the maven-compiler-plugin?</p>
  
  <hr>
  
  <p><em>Update</em>: the <a href="http://code.google.com/p/maven-annotation-plugin/" rel="nofollow noreferrer">maven-annotation-plugin</a> does not seem to work.</p>
  
  <p>When configured as</p>
  
  <pre><code>        &lt;plugin&gt;
              &lt;groupId&gt;org.bsc.maven&lt;/groupId&gt;
              &lt;artifactId&gt;maven-processor-plugin&lt;/artifactId&gt;
              &lt;version&gt;1.0-SNAPSHOT&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;outputDirectory&gt;${generated.sources.directory}&lt;/outputDirectory&gt;
                          &lt;processors&gt;
                              &lt;processor&gt;xxx.annotation.EnforceJavaBeansConventionsProcessor&lt;/processor&gt;
                          &lt;/processors&gt;
                      &lt;/configuration&gt;
                  &lt;/execution&gt;
              &lt;/executions&gt;
          &lt;/plugin&gt;
  </code></pre>
  
  <p>Execution fails with</p>
  
  <pre><code>[INFO] [processor:process {execution: process}]
  error: Annotation processor 'xxx.annotation.EnforceJavaBeansConventionsProcessor' not found
  1 error
  </code></pre>