I would like to use a custom annotation in my project.
How can I configure maven 3 to process my annotation. The annotation and the implementation of the AbstractProcessor class are embedded in my application.
My annotation is available only for testing (src/test/java).
State annotation :
@Target(ElementType.METHOD)
public @interface State {
  boolean success() default true;
}
TestAnnotationsProcessor :
@SupportedAnnotationTypes("com.*****.client.State")
public class TestAnnotationsProcessor extends AbstractProcessor {
  @Override
  public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
    System.out.print("TESSST ANNOTATION");
    return true;
  }
}
I don't want to put my annotation in an external project... it will be stupid because it's really dependend of my project.
How can I do that ? Thanks.
Could you do something like (forgive me if the syntax is a little off, I don't have my IDE handy):
<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-compiler-plugin<artifactId>
  <version>2.3.2</version>
  <executions>
    <execution>
      <goals>
        <goal>testCompile</goal>
      </goals>
      <phase>test-compile</phase>
      <configuration>
        <annotationProcessors>com.******.TestAnnotationsProcessor</annotationProcessors>
        <proc>only</proc>
      </configuration>
    </execution>
  </executions>
</plugin>
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With