Hello experts,

I am in the process of modularizing one of my projects and hit some rather annoying limitations that requires me to change parts of my build and dependencies due to the way the Java module system works.

I usually have modules like x-api, x-impl and x-testsuite where I have a compile time dependency from x-impl to x-api. In x-testsuite I only code against x-api, so I define a Maven runtime dependency on x-impl in order for my CDI container to pick up the implementations. The annoying part is that with modularization I now need to declare my dependency in x-testsuite on x-impl as compile time dependency, because otherwise I can't list the module in the module-info. If I don't list the module, then it is not "visible" to the CDI container, which I guess is on purpose, even though it probably ends up in the module path.

Is that by design that classes are not visible if no module depends on a module like x-impl in such a scenario, or is that maybe something that could work and should be improved in the CDI implementation? I was thinking that if "requires runtime ..." were allowed without checking that the module is available during compilation, this would work fine. Did this idea come up before already?

Regards,

Christian

Reply via email to