Applications for --limit-modules?
Alan.Bateman at oracle.com
Sat Jan 28 17:22:31 UTC 2017
On 28/01/2017 14:34, Nicolai Parlog wrote:
> I'm experimenting with --limit-modules and am not quite sure what
> exactly it is good for.
It's wonderful for testing. Think `java --limit-module java.base -cp
...` to test an application running with just java.base rather than
creating a minimal run-time image with jlink.
> But before I come to that I want to make sure
> I got it right, because I had to figure this out by trial and error
> (the current output of java -? is not that helpful)
limit the universe of observable modules
I guess this could be expanded a bit but it might be too much to attempt
to include text on how it interacts with other options.
> I came to the conclusion that only the modules given to
> --limit-modules will be root modules for the resolution process. This
> explicitly excludes the initial module so unless it is listed as well
> or a transitive dependency of one of the ones that were, the command
> will fail right away.
The set of observable modules is the the transitive closure of the
modules you specify to --limit-modules plus any modules that you specify
to --add-modules or -m (for the main/initial module). There's more on
JEP 261 on this if you need it.
More information about the jigsaw-dev