Skip to main content

APT Usage

annotation-processor Module

Java APT is based on annotation processors. This project example only outputs some print content.

Writing a Processor

example file

If you want to learn more about annotation processors, please read Core-Java-Vol.-II-Advanced-Features-12th-Edition-Cay-S.-Horstmann.

How to Use Processor JAR Package in Other Projects


<!--...-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<annotationProcessorPaths>
<path>
<groupId>com.whalefall</groupId>
<artifactId>annotation-processor</artifactId>
<version>0.0.1-SNAPSHOT</version>
</path>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.26</version>
</path>
</annotationProcessorPaths>
<showWarnings>true</showWarnings>
</configuration>
</plugin>
<!--...Here are include lombok, thus I use the plugin.-->