----- Mail original ----- > De: "Jochen Theodorou" <blackd...@gmx.org> > À: "jigsaw-dev" <jigsaw-dev@openjdk.java.net> > Envoyé: Mercredi 15 Avril 2020 08:55:00 > Objet: Re: excluding transitive module
> On 14.04.20 20:20, Remi Forax wrote: >> Hi Jochen, >> JPMS has no notion of of API and implementation of the same jar. It's a >> concept >> of your build tool and not something JPMS knows. >> >> The notion of compilation dependencies and runtime dependencies is not a >> concept >> of JPMS but a concept of your build tools. >> >> In term of JPMS, if you want to be able to use a jar at compile time and >> another >> one at runtime, >> both should have the same module name, in fact they should have exactly the >> same >> module descriptor (the same module-info). >> >> So in term of dependency, >> - for,Maven/Gradle, the compile dependency will use SharedAPI and the runtime >> dependency SharedApiImpl >> - for JPMS, both have the same module-info and if you want to depend on that >> module, just require it. >> >> From the Maven Central POV, obviously, you have two jars so they can not >> have >> the same arfifact ID (coordinate), but they contains the same >> module-info.class. > > If the case is api and implementation and the same module name, then > using the build tool to exclude the api dependency works. > > If the module name is not the same I have not found a solution. It is a > problem here because of shared packages. as Alex said, this should be fixed by the maintainers of the jars, not you. > > I found this being a problem btw with a lot of jee libraries. > > Of course I can make my project require whatever, but if it is libraries > I do not have under control things get a bit difficult without changing > them. But changing them is not an action really well supported by any > build tool I know. For the Jakarta EE libraries, the main issue is that there are not many jars that has a module-info, so the default strategy to name the automatic module with the jar name fail here because an api an its implementations should have the same name. Injecting the right module-info until your pull request is accepted is an escape hatch. > > bye Jochen Rémi