Le 2024-10-24 à 12 h 07, Robert Scholte a écrit :
Can you explain the problem you're trying to solve? In particular I
don't understand the need for modular-jar and classpath-jar, as
currently both classpath and modulepath are already build up correctly
based on the module descriptors.
The problem is that they are not always build up correctly. Maven uses
heuristic rules, and there is currently no easy way a user could change
Maven's mind when those rules do not match user's intend. Examples:
* A user may want to put non-modular JAR files on the module path.
This is called automatic modules. I'm aware that there are arguments
about whether this is good practice or not, but the new compiler
plugin is not taking position in that debate. Automatic modules are
officially supported and part of the Java specification, and there
are sometime legitimate reasons to want to use them.
* Maven currently puts everything on the class-path when a project is
non-modular. But a non-modular project may still want to put its
modular dependencies on the module-path. This choice changes the way
that services are loaded for example.
So what Maven is currently doing is not always the right thing to do. It
may be a reasonable default however. Therefore, the "jar" type will
continue to behave as today. But the "classpath-jar" and "modular-jar"
types, or something equivalent, are needed when the Maven's heuristic
rules don't do what the user wants.
Martin