Hi Kasper,
The problem is that the component engine consists of many modules, and these
modules were developed by different teams.
Therefore, we need to hide the engine modules from other layers.
After some consideration, I realized the core issue: JPMS doesn’t allow to hide (or make
"private") modules within a layer
using the layer controller.
I’d like to open an issue to suggest adding this capability. By the way, I’m
not sure why this feature wasn’t included from the
start — perhaps Alan Bateman can tell about it.
Best regards, Pavel
On 10/27/24 11:24, Kasper Nielsen wrote:
Kasper Nielsen
14:54 (0 minutes ago)
to PavelTurk
Hi Pavel,
Do you really need to use layers here. Can't you simply just export
the needed classes from engine to car?
module engine {
exports com.engine.api to car;
exports com.engine.internal to car;
}
module car { requires engine; }
/Kasper
On Sat, 26 Oct 2024 at 22:47, PavelTurk <pavelturk2...@gmail.com> wrote:
Hello.
I'm developing a multi-layered JPMS application. Let's say that in the boot
layer, I have a car component (composed of several jars)
that includes an engine (also made up of several jars). All child layers will
interact with the car, but they should not have any access
to the engine or its jars (classes). To achieve this, I want to place all jars
related to the engine in a child layer, thereby hiding these
jars and their classes from other child layers.
However, I’m concerned that this setup results in the boot layer depending on a
child layer, which seems to go against JPMS principles,
where typically child layers depend on or use parent layers.
My question is: does placing the engine in a child layer violate JPMS
principles, and what would be the best approach in this situation?
Best regards, Pavel