Le 2025-05-15 à 22 h 02, Andy Law a écrit :
I still think that the new folder structure feels “dirty”, and from my
current position of ignorance, it also feels like the <module> element
under <source> actually creates a problem that didn’t really exist.
The goal of this JPMS work is to give more control to the developers. We
try to do that by providing Maven configuration options which are mapped
to Java compiler options in a more straightforward way. For example,
Maven 3 was applying heuristic rules for deciding whether to put a JAR
on the class-path or module-path, and a problem was that Maven 3
decision was not always what the developer wanted. Maven 4 is
straightforward:
* If <type> is "classpath-jar", place on the classpath.
* If <type> is "module-path", place on the module-path.
The same apply to new new<source> element.
* If there is no <module>, put the directory in the --source-path
compiler option.
* If there is a <module>, put the directory in a --module-source-path
compileroption.
The syntax of the --module-source-path option is as below:
--module-source-path module-name=directory
As you can see, that option takes the module name in argument. The new
Maven <source> element is not an invention of this proposal. It maps
directly to Java compiler options in the most straightforward way that I
can imagine. We had no way to use that option in Maven 3, except a dirty
way using <args> in plugin configuration and setting <sourceDirectory>
to a dummy value.
Reference:
https://docs.oracle.com/en/java/javase/24/docs/specs/man/javac.html#the-module-source-path-option
Can someone please point me towards the discussion behind the
introduction of that element so I can understand it better?
There are the wiki pages on the clone used for making the prototypes
before to submit the pull requests:
* Maven core: https://github.com/Geomatys/maven/wiki
* Complier plugin: https://github.com/Geomatys/maven-compiler-plugin/wiki
Those pages, if accepted, would move to some Maven documentation site,
but I'm not sure where.
Martin