Hello Ralf

Le 05/12/2025 à 07:13, Ralf Ueberfuhr via dev a écrit :

Why are processor-typed dependencies included, when annotation processing is only happening at build time?
Maven 4 unifies two aspects which, previously, were handled in heterogeneous ways:

 * Declaration of source and resources (with the new <sources> element).
 * Declaration of the locations where to place dependencies.

The second item come from a need to control whether to place a dependency on the class-path or module-path. This choice can change the behavior of a library. Maven 3 tries to guess (it is still the default in Maven 4), which is sometime correct but is problematic when the guess is not correct. For giving control to the developers, new types were added: classpath-jar and modular-jar.

Since the above uses dependency type as a way to control where to place the dependency, the idea could be generalized to other kinds of path: processor path, doclet path, taglet path, maybe more in the future. Therefore, processor type is an extension of above idea meaning that the target of the dependency is neither the class-path or module-path, but the processor-path. In the future, we may continue with the same idea, with the addition of "taglet" and "doclet" types meaning to put the dependency on the taglet path or doclet path. They would be in a situation similar to the processor type, used only at build time.

An advantage of this approach is that the dependencies are managed like ordinary dependencies, rather than a plugin-specific configuration that duplicates code from Maven core. I'm not sure that dependency managed by plugin code had all the functionalities of dependencies managed by Maven core (but others Maven developer would know better than me).

Note: there is an issue with the current code, which is that the transitive dependencies of an annotation processor are not handled correctly yet. I think that Tamas has a pull request in Maven core for that issue.

    Martin

Reply via email to