in src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java [1498:1530]
final void resolveProcessorPathEntries(Map<PathType, List<Path>> addTo) throws MojoException {
List<DependencyCoordinate> dependencies = annotationProcessorPaths;
if (dependencies != null && !dependencies.isEmpty()) {
try {
List<org.apache.maven.api.DependencyCoordinates> coords = dependencies.stream()
.map((coord) -> coord.toCoordinate(project, session))
.toList();
Session sessionWithRepo =
session.withRemoteRepositories(projectManager.getRemoteProjectRepositories(project));
addTo.merge(
JavaPathType.PROCESSOR_CLASSES,
sessionWithRepo
.getService(DependencyResolver.class)
.resolve(DependencyResolverRequest.builder()
.session(sessionWithRepo)
.dependencies(coords)
.managedDependencies(project.getManagedDependencies())
.requestType(DependencyResolverRequest.RequestType.RESOLVE)
.pathScope(PathScope.MAIN_RUNTIME)
.build())
.getPaths(),
(oldPaths, newPaths) -> {
oldPaths.addAll(newPaths);
return oldPaths;
});
} catch (MojoException e) {
throw e;
} catch (Exception e) {
throw new CompilationFailureException(
"Resolution of annotationProcessorPath dependencies failed: " + e.getMessage(), e);
}
}
}