Question

I'm trying to process annotations with my own annotations processor in a maven project. Using org.bsc.maven:maven-processor-plugin I had some success, but many problems. I wonder if there is a demo project comparable to my usage scenario I could compare to.

Was it helpful?

Solution

Surprisingly all what was needed is adding a dependency on the project with the annotation processor.

dp4jmaventest is a sample project for dp4j annotations processor.

My problem was that of trying to process annotations in classes within the same annotation processing project. The solution is to compile on two phases.

</configuration>
            <executions>
                <execution>
                    <id>default-compile</id>
                    <configuration>
                        <compilerArgument>-proc:none</compilerArgument>
                        <includes>
                            <include>com/dp4j/**</include>
                            <include>com/dp4j/processors/core/**</include>
                            <include>com/dp4j/processors/**</include>
                        </includes>
                    </configuration>
                </execution>
                <execution>
                    <id>compile-everything-else</id>
                    <phase>compile</phase>
                    <goals>
                        <goal>compile</goal>
                    </goals>
                </execution>
            </executions>
<!--http://cdivilly.wordpress.com/2010/03/16/maven-and-jsr-269-annotation-processors/-->

dp4j maven project is a working example project.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top