-
Notifications
You must be signed in to change notification settings - Fork 1
Installation
If you are using Maven your pom.xml should look like this:
<properties>
<japkit.version>1.23</japkit.version>
<m2e.apt.activation>jdt_apt</m2e.apt.activation>
</properties>
...
<dependencies>
<!-- provides annotations like @Trigger, @Class, @Field -->
<dependency>
<groupId>com.github.japkit</groupId>
<artifactId>japkit-annotations</artifactId>
<version>${japkit.version}</version>
</dependency>
</dependencies>
...
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<annotationProcessorPaths>
<path>
<groupId>com.github.japkit</groupId>
<artifactId>japkit-all-javael3</artifactId>
<version>${japkit.version}</version>
</path>
</annotationProcessorPaths>
<compilerArgs>
<compilerArg>
-Aannotations=my.trigger.annotations.package.*
</compilerArg>
</compilerArgs>
</configuration>
</plugin>
</plugins>
</build>
Replace my.trigger.annotations.package
with the name of the package where you define your trigger annotations.
Using annotationProcessorPaths
is the most recent way to setup annotation processors in Maven (since version 3.5 of maven-compiler-plugin). It's advantage is the separation of the annotation processor dependencies from the other dependencies which helps to prevent collisions on classpath. But there are still some issues with that approach:
- IntelliJ does not recognize
annotationProcessorPaths
until IDEA-150621 is implemented.- Meanwhile (March 2018) it seems to be fixed. But there are some open discussions at IDEA-150621.
- Due to MCOMPILER-272 you will run into issues when having multiple annotation processors with transitive dependencies.
- The
tycho-jdt-compiler
does also not supportannotationProcessorPaths
yet. See here.
If any of this is a concern to you, a workaround is to add japkit-all-*
as a project dependency with <optional>true</optional>
in your pom.xml instead of using annotationProcessorPaths
. If you have multiple annotation processors, do not mix both approaches.
Make sure you have the latest version of the m2e-apt plugin installed, which picks up and applies the annotation processor settings from pom.xml automatically.
If you use (an older version of) Spring Tool Suite or Spring IDE please make sure to deactivate the following options:
Those options are similar to what m2e-apt does but they only work if Spring Boot's configuration metadata processor is on classpath. In any other case they will disable annotation processing for your project.