Skip to content
Latchkey

Maven "Annotation processor ... not found" / Processing Errors in CI

The compiler could not run an annotation processor (or its generated sources are missing), so code that depends on generated classes fails to compile. On JDK 23+ annotation processing is also disabled by default unless explicitly enabled, which breaks Lombok/MapStruct-style builds.

What this error means

Compilation fails with Annotation processor 'X' not found, or with cannot find symbol for classes a processor was supposed to generate (e.g. a MapStruct *MapperImpl or a Lombok-generated getter).

mvn output
[ERROR] /src/main/java/com/example/OrderMapper.java:[12,8] cannot find symbol
  symbol:   class OrderMapperImpl
[ERROR] warning: Annotation processing is enabled because one or more processors
were found on the class path. A future release of javac may disable ...

Common causes

Processor not on the annotation processor path

The processor jar is a dependency but not declared in <annotationProcessorPaths> (or processing was turned off), so javac never runs it and the generated sources never appear.

Annotation processing disabled by default (JDK 23+)

Newer JDKs no longer enable annotation processing implicitly. Without -proc:full (or an explicit processor path), processors are silently skipped and dependent code fails.

How to fix it

Declare the processor on the compiler plugin

Add the processor to <annotationProcessorPaths> so javac runs it and generates sources.

pom.xml
<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-compiler-plugin</artifactId>
  <configuration>
    <annotationProcessorPaths>
      <path>
        <groupId>org.mapstruct</groupId>
        <artifactId>mapstruct-processor</artifactId>
        <version>1.6.0</version>
      </path>
    </annotationProcessorPaths>
  </configuration>
</plugin>

Enable processing explicitly on newer JDKs

On JDK 23+, make processing explicit so it is not skipped.

pom.xml (compiler)
<configuration>
  <compilerArgs>
    <arg>-proc:full</arg>
  </compilerArgs>
</configuration>

How to prevent it

  • Declare processors in <annotationProcessorPaths>, not just as plain dependencies.
  • Pin processor versions so generated output is reproducible.
  • Set -proc:full explicitly so JDK-default changes do not silently disable processing.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →