How to exclude modules?

Alan Bateman alan.bateman at oracle.com
Mon Aug 12 07:54:36 UTC 2024


On 05/08/2024 12:38, Jörg Sautter wrote:
> Hi all,
>
> i am using the module system for a while now and have some problems with removing dependencies from the classpath.
> In the past i could just exclude them from the maven project and everything was working fine.
>
> Now with modules enabled i get an error some modules are missing and i have to workaround with empty modules.
>
> You may ask why i want to remove some modules, there are several reasons:
> - i have to do complex FOSS licences checks / health checks for each dependency i use, so i try to minimize them
> - deploy smaller container images and lower the surface for supply chain attacks
> - minimize the efforts to update depencencies i do not use (and cooperate toolchain will complain i should upgrade)
>
> I know it is kind of risky to exclude them, but especially when using open source depencencies there are alot
> projects which do not have adopted the module system at all and do miss a structure which does allow the
> automatic modules to work well.
>
> Is there a better way to exclude these modules from the module system than creating empty dummies?
>
Modules are about reliable configuration so excluding modules that are 
required by other modules doesn't make sense.

I'm curious about your workaround to use "empty modules" as I would 
expect NoClassDefFoundError. Are you saying that M1 requires M2 but has 
not reference to any classes in M2?

-Alan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/jigsaw-dev/attachments/20240812/b7002c08/attachment-0001.htm>


More information about the jigsaw-dev mailing list