AnnotationProcessorOptions

Options for configuring Java annotation processors.

Properties

PropertyDescription
arguments

Specifies arguments that represent primitive types for annotation processors.

classNames

Specifies the annotation processor classes to run.

compilerArgumentProviders

Specifies arguments for annotation processors that you want to pass to the Android plugin using the CommandLineArgumentProvider class.

includeCompileClasspath

Whether to include compile classpath in the processor path.

Methods

No methods

Script blocks

No script blocks

Property details

Map<String, String> arguments

Specifies arguments that represent primitive types for annotation processors.

If one or more arguments represent files or directories, you must instead use AnnotationProcessorOptions.getCompilerArgumentProviders().

List<String> classNames

Specifies the annotation processor classes to run.

By default, this property is empty and the plugin automatically discovers and runs annotation processors that you add to the annotation processor classpath. To learn more about adding annotation processor dependencies to your project, read Add annotation processors.

List<CommandLineArgumentProvider> compilerArgumentProviders

Specifies arguments for annotation processors that you want to pass to the Android plugin using the CommandLineArgumentProvider class.

The benefit of using this class is that it allows you or the annotation processor author to improve the correctness and performance of incremental and cached clean builds by applying incremental build property type annotations.

To learn more about how to use this class to annotate arguments for annotation processors and pass them to the Android plugin, read Pass arguments to annotation processors.

Boolean includeCompileClasspath

Whether to include compile classpath in the processor path.

By default, the Android plugin throws a build error when you add annotation processors to your project's compile classpath. You must instead add annotation processors to the processor classpath using the annotationProcessor dependency configuration. This behavior exists to improve build performance by separating the compile classpath from the annotation processor classpath.

If, however, you still want to add a dependency that includes an annotation processor to the compile classpath, but you don't need to run the processor, you can disable the error check by setting this property to false.

If you experience issues after migrating your project's annotation processors to the processor classpath, you can allow annotation processors on the compile classpath by setting this property to true. However, setting this property to true is not recommended, and the option to do so will be removed in a future update.

By default, this property is null.