APT Usage
annotation-processor Module
JAVA APT based on annotation processor, this project case only outputs some printed content.
Write a processor
If you want to know more about annotation processors, please read Core-Java-Vol.-II-Advanced-Features-12th-Edition-Cay-S.-Horstmann.
If using Processor jar package in other projects
- maven
- gradle
<!--...-->
<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.-->
dependencies {
// ...
annotationProcessor 'com.whalefall:annotation-processor:0.0.1-SNAPSHOT'
testAnnotationProcessor 'com.whalefall:annotation-processor:0.0.1-SNAPSHOT'
// if you are using processor in test code
// if you use this in other module of the aggregation project
annotationProcessor project(':annotation-processor')
}
Agreement
The code part of this work is licensed under Apache License 2.0 . You may freely modify and redistribute the code, and use it for commercial purposes, provided that you comply with the license. However, you are required to:
- Attribution: Retain the original author's signature and code source information in the original and derivative code.
- Preserve License: Retain the Apache 2.0 license file in the original and derivative code.
- Attribution: Give appropriate credit, provide a link to the license, and indicate if changes were made.
- NonCommercial: You may not use the material for commercial purposes. For commercial use, please contact the author.
- ShareAlike: If you remix, transform, or build upon the material, you must distribute your contributions under the same license as the original.