in src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java [1538:1568]
private boolean hasAnnotationProcessor() {
if ("none".equalsIgnoreCase(proc)) {
return false;
}
if (proc == null || proc.isBlank()) {
/*
* If the `proc` parameter was not specified, its default value depends on the Java version.
* It was "full" prior Java 21 and become "none if no other processor option" since Java 21.
* Since even the full" case may do nothing, always check if a processor is declared.
*/
if (annotationProcessors == null || annotationProcessors.length == 0) {
if (annotationProcessorPaths == null || annotationProcessorPaths.isEmpty()) {
DependencyResolver resolver = session.getService(DependencyResolver.class);
if (resolver == null) { // Null value happen during tests, depending on the mock used.
return false;
}
var allowedTypes = EnumSet.of(JavaPathType.PROCESSOR_CLASSES, JavaPathType.PROCESSOR_MODULES);
DependencyResolverResult dependencies = resolver.resolve(DependencyResolverRequest.builder()
.session(session)
.project(project)
.requestType(DependencyResolverRequest.RequestType.COLLECT)
.pathScope(compileScope)
.pathTypeFilter(allowedTypes)
.build());
return !dependencies.getDependencies().isEmpty();
}
}
}
return true;
}