开发者

How to process annotations with Maven?

I'm trying to process annotations with my o开发者_如何学Cwn 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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜