title: How to use custom annotation processor with Maven 2?
body: <p>In our enterprise application we are seeking a dynamic way to collect data from our Java classes. We created a custom annotation interface (<code>@interface</code>) with a <code>name</code> property. We would like to collect the value of this property from all annotated classes. </p>
  
  <p>I managed to create an <code>AnnotationProcessorFactory</code> and an <code>AnnotationProcessor</code> for the custom annotation. Since we are using Maven 2, I added the following to the plugins in the <code>pom.xml</code> of the main project.</p>
  
  <pre><code>    &lt;plugin&gt;
        &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
        &lt;artifactId&gt;apt-maven-plugin&lt;/artifactId&gt;
        &lt;version&gt;1.0-alpha-5&lt;/version&gt;
        &lt;configuration&gt;
          &lt;factory&gt;our.company.api.component.lister.ComponentAnnotationProcessFactory&lt;/factory&gt;
        &lt;/configuration&gt;
      &lt;/plugin&gt;
  </code></pre>
  
  <p>This resides in the main project which has several sub-projects. The factory and the custom processor are in one of these sub-projects. The custom annotations are scattered through all of the sub-projects that is why I put the plugin in the <code>pom.xml</code> of the main project.</p>
  
  <p>The problem is when I issue the <code>mvn apt:process</code> command I got a warning about the annotations without processors and our custom annotation is among them. I assume this means that the plugin cannot find the factory class. </p>
  
  <p>What should I do so the plugin could find the factory and the processor file? </p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>The project hierarchy is very simple:</p>
  
  <pre><code>main_project
  |-sub_project1
  |...
  |-sub_projectn
  </code></pre>
  
  <p>The plugin is in the <code>pom.xml</code> of the <code>main_project</code>. Just assume that the factory and processor are in <code>sub_project1</code> and the custom annotations are in <code>sub_project2</code>, <code>sub_project3</code>, ..., <code>sub_projectn</code></p>