MapStruct "No implementation was created for Mapper" - Fix in CI
MapStruct generates a *MapperImpl during annotation processing. If the processor is not on the annotation-processing path, or a mapping is unresolvable, no implementation is generated and Mappers.getMapper(...) or injection of the mapper fails at compile or runtime.
What this error means
Compilation reports No implementation was created for FooMapper due to having a problem in the erroneous element, or runtime fails with ClassNotFoundException: com.example.FooMapperImpl / NoSuchBeanDefinitionException for the mapper.
error: No implementation was created for OrderMapper due to having a problem
in the erroneous element jakarta.persistence ... Hint: this often means that
some other annotation processor failed first, or MapStruct is not registered.Diagnose it: get the real failure out of Gradle
Gradle summarises failures aggressively, and the top-level message frequently describes a downstream symptom rather than the cause. Re-run the failing task with diagnostics before changing build logic.
# the actual stack, plus what Gradle decided about the build
./gradlew <task> --stacktrace --info
# is a stale daemon or cache involved?
./gradlew --stop
./gradlew <task> --no-daemon --no-build-cache
# what does Gradle think the environment is?
./gradlew -versionCommon causes
Processor not declared
mapstruct-processor is not on annotationProcessor (Gradle) / annotationProcessorPaths (Maven), so no impl is generated.
Another processor failed first
Lombok or a different processor errored, aborting the round so MapStruct never produced its output.
Unmappable property with default policy
An unmapped target property under a strict unmappedTargetPolicy = ERROR fails generation.
How to fix it
Declare the MapStruct processor
Add the processor on the annotation-processing path.
dependencies {
implementation 'org.mapstruct:mapstruct:1.6.0'
annotationProcessor 'org.mapstruct:mapstruct-processor:1.6.0'
}Order Lombok and MapStruct correctly
When using both, add the lombok-mapstruct binding so Lombok output is visible to MapStruct.
dependencies {
annotationProcessor 'org.projectlombok:lombok:1.18.34'
annotationProcessor 'org.projectlombok:lombok-mapstruct-binding:0.2.0'
annotationProcessor 'org.mapstruct:mapstruct-processor:1.6.0'
}Resolve the unmapped property
Map or ignore the property the error names so generation completes.
@Mapping(target = "id", ignore = true)
OrderDto toDto(Order order);Configuration cache and CI
- The configuration cache rejects build logic that reads mutable state at execution time, which is why enabling it surfaces errors an existing build never showed.
- Run with
--configuration-cache-problems=warnfirst to see the full list rather than failing on the first one. - A cached configuration keyed to a different environment is worse than none. Include the JDK version in your cache key.
How to prevent it
- Declare
mapstruct-processorin every module that defines mappers. - Add
lombok-mapstruct-bindingwhen both processors are present. - Keep mappings exhaustive or explicitly ignore unmapped targets.