<dependency>
<groupId>org.ow2.util.annotation</groupId>
<artifactId>ow2-util-annot-processor</artifactId>
<version>1.0.0</version>
</dependency>
groovy
dependencies {
implementation 'org.ow2.util.annotation:ow2-util-annot-processor:1.0.0'
}
import java.lang.annotation.*;
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface MyAnnotation {
String value() default "";
}
import org.ow2.util.annotation.processor.api.*;
public class MyAnnotationProcessor implements AnnotationProcessor {
@Override
public void process(AnnotationProcessingContext context) {
for (AnnotatedElement annotatedElement: context.getElementsAnnotatedWith(MyAnnotation.class)) {
}
}
}
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<annotationProcessorPaths>
<path>
<groupId>org.ow2.util.annotation</groupId>
<artifactId>ow2-util-annot-processor</artifactId>
<version>1.0.0</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
</plugins>
</build>
groovy
plugins {
id 'java'
}
dependencies {
annotationProcessor 'org.ow2.util.annotation:ow2-util-annot-processor:1.0.0'
}
compileJava {
options.annotationProcessorPath = configurations.annotationProcessor
}