Configure annotation processors

Last modified: 11 February 2024

You can configure IntelliJ IDEA to process custom annotations during the compilation time. The process of generating code at compile time to handle the annotations is called Annotation Processing.

The annotation processor can validate, generate, and modify your code based on the annotations, which help you significantly reduce the amount of code you need to write. The annotation processor could be stored inside your project. In this case IntelliJ IDEA obtains it from the classpath. If the annotation processor is stored outside the project then you need to add a path of the annotation processor JAR manually.

When you add annotation processors through the build scripts in Maven or Gradle projects, IntelliJ IDEA automatically enables the annotation processing and adds the appropriate paths in the annotation processor settings.