In our enterprise application, we are looking for a dynamic way to collect data from our Java classes. We created an annotation user interface ( @interface
) with the name
property. We would like to get the value of this property from all annotated classes.
I managed to create AnnotationProcessorFactory
and AnnotationProcessor
for custom annotation. Since we are using Maven 2, I added the following plugins to the pom.xml
main project.
<plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>apt-maven-plugin</artifactId> <version>1.0-alpha-5</version> <configuration> <factory>our.company.api.component.lister.ComponentAnnotationProcessFactory</factory> </configuration> </plugin>
This is in the main project, which has several subprojects. factory and user processor are in one of these subprojects. User annotations are scattered across all subprojects, so I put the plugin in pom.xml
main project.
The problem is that when I issue the mvn apt:process
command, I received a warning about annotation without processors, and there is a separate annotation among them. I assume this means that the plugin cannot find the factory class.
What should I do so that the plugin can find the factory and processor file?
EDIT:
The project hierarchy is very simple:
main_project |-sub_project1 |... |-sub_projectn
The plugin is located in pom.xml
main_project
. Let's say that the factory and processor are in sub_project1
, and the user annotations are in sub_project2
, sub_project3
, ..., sub_projectn
source share