IntelliJ IDEA 2019.3 Help

Annotation Processors

Annotation processing profiles

Item

Keyboard Shortcut

Description

icons general addAlt+Insert

Click this button to create a new profile.

icons general removeAlt+Delete

Click this button to delete the selected profile from the list of existing profiles. All modules, associated with this profile, will be automatically moved to the default profile.

icons actions forward F6

Click this button to associate a module with a profile. This button only becomes available, when a module in the list of modules under a certain profile gets the focus.

Annotation processors settings

Item

Description

Enable annotation processing

If you want annotation processors to be run during compilation, select this checkbox and specify associated options:

  • Obtain processors from project classpath: Select this option, if you want IntelliJ IDEA to obtain the annotation processors from the project classpath. This is useful, for example, if you use a custom annotation processor as part of your project, or if the processor is stored in a .jar file attached to all the corresponding modules as a library.

  • Processor path:Select this option and specify in the field to the right the path to the annotation processor, if it is not desirable to include the processor into the project or project libraries.

    If you have a Gradle project that has the annotationProcessor dependency specified in the build.gradle file, then this field will contain a path to annotation processor used by Gradle when you import your Gradle project. When you build such project with Gradle, IntelliJ IDEA generates the appropriate subdirectories inside the build directory in the Project tool window.

    Project tool window: annotationProcessor

  • Use --processor-module-path compiler option (for java 9 and later): assume that the specified path is a module path: a path of JARs or directories containing packaged Java modules. In order to be discovered and run from the module path, an annotation processor should be packaged as a Java module and registered with the ServiceLoader in the module declaration.

  • Store generated sources relative to: Use the fields below to define where the sources, generated by the annotation processors, are stored, and to override the default behaviour for a profile.

    • Module output directory: By default, the sources generated by annotation processors are stored relative to the module output directory.

    • Module content root: Choose this option to override the default behaviour for a profile.

    At a later time, if you want to use the generated classes as your own sources, you can mark the corresponding directories as source roots.

Processor FQ Name

Specify the processor fully qualified name.

Use icons general add Alt+Insert or icons general remove Alt+Delete to make up the list of annotation processors to be run.

Annotation processor options

If necessary, specify the processor run options either as -key=value, or key=value.

Use spaces to separate individual options.

Use icons general add Alt+Insert or icons general remove Alt+Delete to make up the list of options to be passed to the annotation processors.

Last modified: 26 April 2020