I'll start by saying that it definitely should not be 3, because you will
not be able to tell by structure (for certain) whether a directory
constitutes a module or whether it is some other kind of resource.

As someone who has been at least somewhat involved with the JPMS since the
beginning, and who has many projects which are modular already, I do not
think that it is necessary, useful, or wise to support multi-module
compilation from Maven or any other build tool. It is incompatible with MR
JAR production (which is far more useful and common in my experience) or
any other kind of layered compilation, and many of the advantages of this
style of compilation can be simulated in other ways. It really feels like
this is something that is being proposed because it's possible, not because
it is useful (or at least, useful enough to justify breaking useful
existing assumptions that a user or plugin developer could make).

On Thu, May 15, 2025 at 11:34 AM Martin Desruisseaux <
martin.desruisse...@geomatys.com> wrote:

> Hello all
>
> Currently, the default directory for source code in Maven 4 is:
>
>     src/${scope}/${lang}
>
> Where ${scope} is "main" or "test" and ${lang} is "java" or "resources".
> However, in the case of a multi-modules JPMS projects, we need to add
> the module name somewhere. Notes:
>
>   * This change applies only to multi-modules projects. Non-modular
>     projects, or modular projects with only one module, will see no change.
>   * The output directory of a multi-modules project also changes: it
>     becomes target/classes/${module} where ${module} is inserted by
>     javac itself. So the addition of a ${module} directory is an
>     invention of this proposal.
>
> Three proposals have been discussed on the pull request #2278:
>
>  1. src/${module}/${scope}/${lang}
>  2. src/${lang}/${module}/${scope}
>  3. src/${scope}/${lang}/${module}
>
> Proposals 1 and 3 are the same as the current Maven convention with only
> ${module} added either at the beginning or at the end. Proposal 2 is
> more disruptive, but produces the most compact directory trees and takes
> in account the fact that each language has its own concept of modules
> with its own naming conventions. Proposals 1 and 3 are more
> conservative, with proposal 1 seing modules as a kind of sub-projects
> (files related to the same module are kept together) and proposal 3
> rather seing the module system as an extension of the package system.
> These 3 proposals are described in more details there, together with
> examples:
>
>
> https://cwiki.apache.org/confluence/display/MAVEN/Default+directory+for+modular+projects
>
> What peoples think that the default should be?
>
>      Martin
>
>

-- 
- DML • he/him

Reply via email to