Thanks for the detail. It was helpful and I don’t think that my mental model of 
maven is broken. I still think that the <module> tag under <source> is “wrong” 
😊, but as you’ll have probably guessed, I have no plans to build multiple 
modules from a single project – multi-release or otherwise.

Later,

Andy



From: Martin Desruisseaux <martin.desruisse...@geomatys.com>
Date: Saturday, 17 May 2025 at 17:46
To: Andy Law <andy....@roslin.ed.ac.uk>, Maven Developers List 
<dev@maven.apache.org>
Subject: Re: Proposal: new default directory layout for modular project

Le 2025-05-17 à 18 h 30, Andy Law a écrit :
 How do multi-release and multi-module relate one to another

From the user's point of view, they are orthogonal. We can use multi-releases 
or not. We can use multi-modules or not. Those two features are governed by two 
independent XML elements inside <source>, namely <targetVersion> and <module> 
respectively. Under the hood, the Maven compiler plugin needs to use a 
different set of compiler options depending on whether multi-releases is used 
alone or together with multi-modules (this is another reason why it is 
practical to keep those options under the same <source> element, because the 
plugin needs those two information together). But it can be transparent for 
users.


I would define a module as a single Maven project with multiple version 
directories all under src/main.

For a non-modular project doing a multi-releases JAR, yes, it is exactly that 
way and is already supported in maven-compiler-plugin 4.0.0-beta-3 (not yet 
released) with configuration like this example:

https://github.com/Geomatys/maven-compiler-plugin/wiki/User-guide#multi-releases-project


Because one project maps to one module, there is no need for the compiler “… to 
know which module we are patching with code for a different Java release” 
because it is obviously the only module that is being generated by the project.

Yes, this is right for non-modular projects. That sentence that I wrote in my 
previous email is true only for a project mixing *both* multi-releases and 
multi-modules in the same project.

Again, <module> is only for peoples who want JPMS. For peoples who are not 
interested in JPMS, all the evolution done in Maven core and in the compiler 
plugin have been designed in such a way that users can ignore JPMS and 
nevertheless get the other improvements, such as multi-releases, without any 
need to care about module.

    Martin



The University of Edinburgh is a charitable body, registered in Scotland, with 
registration number SC005336. Is e buidheann carthannais a th’ ann an Oilthigh 
Dhùn Èideann, clàraichte an Alba, àireamh clàraidh SC005336.

Reply via email to