Hello again

I wrote a test case with a very small Maven project (only trivial code)  reproducing the problem and a README.md file explaining the problem. The Maven behavior is then reproduced on the command-line, and the expected behavior provided by a command-line too. Unless there is some configuration options that I didn't see, the current Maven behavior regarding module-path seems to be a quasi-blocker for gradual migration of large projects to JPMS.

   https://github.com/Geomatys/MavenModulepathBug

The ideal solution for me would be to have explicit control on whether to put a dependency on the module path versus the class-path. Is there some way to do that that I have missed?

    Thanks,

        Martin


Le 26/07/2023 à 18:42, Martin Desruisseaux a écrit :

Hello

If I'm understanding right, Maven put a dependency on the module-path instead of the class-path only if:

 1. the dependency is modularized (contains a "module-info" file), and
 2. the project using the dependency is itself modularized.

Condition #1 is fine, but #2 is problematic. If a dependency is on the classpath, then the dependency is loaded as an unnamed module, its "module-info" file is ignored and the services that it contains are not discovered. Not only the services that the non-modularized project may be looking for (I understand that it may not work), but the modularized dependency itself cannot find anymore its own services, or the services of its modularized dependencies, if those dependencies were not on the module-path.

Is there a way to force Maven to ignore condition #2 and use only condition #1 for deciding whether to put a dependency on the module path or not?

    Thanks,

        Martin

Reply via email to