title: Need file from src/main/resources in generate-sources phase for annotation processor config
body: <p>I have an annotation processor that I need to give some configuration to tell it a few details about how I want it to generate source code.  I spent a good deal of time trying to understand why the file was sitting in target/classes after the build, but I was getting an exception during annotation processing stating that the file did not, in fact, exist.</p>
  
  <p>After much digging I finally figured out why the file (stored in <code>src/main/resources/config</code>) isn't getting copied over to <code>target/classes/config</code> for my annotation processor to read - <code>generate-sources</code> happens before <code>process-resources</code> in the build lifecycle, so the file isn't getting copied over in time for the annotation processor to see it during its run. (maven build lifecycle reference: <a href="http://maven.apache.org/ref/3.2.2/maven-core/lifecycles.html" rel="nofollow">http://maven.apache.org/ref/3.2.2/maven-core/lifecycles.html</a>)</p>
  
  <p>Here's a high level overview of what I'm trying to do:</p>
  
  <p>I have a jar that I've built that processes annotations and generates interface classes from the information in the annotations to base a client api off of.  The idea is that including that jar as a compile-time dependency should automatically generate this code for any project that uses these annotations (with as little-as-possible additional configuration in the client project's pom.xml).</p>
  
  <p>How do I go about either:</p>
  
  <ol>
  <li>Getting (at a minimum) the config.xml portion of process-resources to happen before generate-sources</li>
  <li>Adding the file to the classpath of the annotation processor in some other way (we don't need this file in the output archive, so this might be better)</li>
  <li>I am also open to other (clean) ways of getting configuration information into the annotation processor if there is a better way that I haven't thought of</li>
  </ol>
  
  <p>I would prefer not to write a whole maven plugin for this if possible.</p>
  
  <p><strong><em>Edit:</em></strong>
  Here are the relevant parts of the <code>&lt;build&gt;</code> portion of my client pom per request:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;build&gt;
      &lt;finalName&gt;OurApp&lt;/finalName&gt;
      &lt;resources&gt;
          &lt;resource&gt;
              &lt;!-- My config.xml file is located here --&gt;
              &lt;directory&gt;src/main/resources&lt;/directory&gt;
          &lt;/resource&gt;
          &lt;resource&gt;
              &lt;directory&gt;src/main/webapp&lt;/directory&gt;
              &lt;includes&gt;
                  &lt;include&gt;*.*&lt;/include&gt;
              &lt;/includes&gt;
              &lt;excludes&gt;&lt;exclude&gt;${project.build.directory}/generated-sources/**&lt;/exclude&gt;&lt;/excludes&gt;
          &lt;/resource&gt;
      &lt;/resources&gt;
      &lt;plugins&gt;
          &lt;!-- Omit Annotation Processor lib from the compilation phase because the code generated is destined for another, separate jar --&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
              &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
              &lt;version&gt;${maven-compiler-plugin.version}&lt;/version&gt;
              &lt;executions&gt;
                &lt;execution&gt;
                  &lt;id&gt;annotation-processing&lt;/id&gt;
                  &lt;phase&gt;generate-sources&lt;/phase&gt;
                  &lt;goals&gt;
                    &lt;goal&gt;compile&lt;/goal&gt;
                  &lt;/goals&gt;
                  &lt;configuration&gt;
                    &lt;proc&gt;only&lt;/proc&gt;
                  &lt;/configuration&gt;
                &lt;/execution&gt;
                &lt;!-- Compile the rest of the code in the normal compile phase --&gt;
                &lt;execution&gt;
                  &lt;id&gt;compile-without-generated-source&lt;/id&gt;
                  &lt;phase&gt;compile&lt;/phase&gt;
                  &lt;goals&gt;
                    &lt;goal&gt;compile&lt;/goal&gt;
                  &lt;/goals&gt;
                  &lt;configuration&gt;
                    &lt;excludes&gt;&lt;exclude&gt;${project.build.directory}/generated-sources/**&lt;/exclude&gt;&lt;/excludes&gt;
                    &lt;proc&gt;none&lt;/proc&gt;
                    &lt;!-- http://jira.codehaus.org/browse/MCOMPILER-230 because this doesn't
                         work in the opposite direction (setting failOnError in the other execution 
                         and leaving the default top-level value alone) --&gt;
                    &lt;failOnError&gt;true&lt;/failOnError&gt;
                  &lt;/configuration&gt;
                &lt;/execution&gt;
              &lt;/executions&gt;
              &lt;configuration&gt;
                  &lt;source&gt;${java.version}&lt;/source&gt;
                  &lt;target&gt;${java.version}&lt;/target&gt;
                  &lt;proc&gt;only&lt;/proc&gt;
                  &lt;failOnError&gt;false&lt;/failOnError&gt;
              &lt;/configuration&gt;
          &lt;/plugin&gt;
          &lt;!-- package generated client into its own SOURCE jar --&gt;
          &lt;plugin&gt;
              &lt;artifactId&gt;maven-assembly-plugin&lt;/artifactId&gt;
              &lt;version&gt;2.4.1&lt;/version&gt;
              &lt;configuration&gt;
                  &lt;descriptorRefs&gt;
                      &lt;descriptorRef&gt;generated-client-source&lt;/descriptorRef&gt;
                  &lt;/descriptorRefs&gt;
              &lt;/configuration&gt;
              &lt;dependencies&gt;
                  &lt;dependency&gt;
                      &lt;groupId&gt;com.package&lt;/groupId&gt;
                      &lt;artifactId&gt;our-api&lt;/artifactId&gt;
                      &lt;version&gt;${our-api.version}&lt;/version&gt;
                  &lt;/dependency&gt;
              &lt;/dependencies&gt;
              &lt;executions&gt;
                  &lt;execution&gt;
                      &lt;id&gt;client-source&lt;/id&gt;
                      &lt;phase&gt;package&lt;/phase&gt;
                      &lt;goals&gt;
                          &lt;goal&gt;single&lt;/goal&gt;
                      &lt;/goals&gt;
                  &lt;/execution&gt;
              &lt;/executions&gt;
          &lt;/plugin&gt;
      &lt;/plugins&gt;
  &lt;/build&gt;
  </code></pre>