Hi Martin,

On 31.03.2025 19:40, Martin Desruisseaux wrote:
JPMS support in the compiler plugin (not yet merged) has reached a point where it can be used on some real projects. The Maven 3 way to make a modular project is still supported, but the proposed alternative for better use of JPMS is described here:

 * https://github.com/Geomatys/maven-compiler-plugin/wiki/User-guide#modular-project  * https://github.com/Geomatys/maven-compiler-plugin/wiki/Migration#modular-projects

The changes look nice, especially in the "multi-releases project" case.

I fail to understand, however, the purpose of the "modular project" layout. As far as I know, there is currently no support for multiple JPMS modules in the same JAR. I am also afraid that such a structure will really break IDEs: Eclipse already breaks if there is a separate module descriptor for tests, putting multiple JPMS modules in the same Maven Project will probably also break IDEA.

When it comes to JPMS and the current Maven Compiler Plugin, what I mostly miss it the possibility to have two source and output folders for tests: unit/whitebox tests need to break encapsulation and either run on the classpath or with `--patch-module`, while integration/blackbox tests should run from a separate JPMS module. Due to the restrictions on the number of output folders, currently we end up with 3 Maven Modules per published JAR, e.g.:

- `log4j-core` contains only production code in `src/main`.

- `log4j-core-test` contains test fixtures (e.g. JUnit Extensions) in `src/main`. These are reusable and published.

- `log4j-core-test` contains unit tests in `src/test` (runs on classpath).

- `log4j-core-its` contains integration tests in `src/main`.

Piotr


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
For additional commands, e-mail: dev-h...@maven.apache.org

Reply via email to