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.

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.

bye Jochen

Reply via email to