Thanks for the explanation, it clears up why things are the way they are. Even so, I'm not necessarily interested in only the modules I'd get in a single "round." I'd like to add extra modules for the service classes I specify via an arg, even across multiple rounds.
That is, my application module info doesn't have any `uses` statement, but some of the required dependencies have multiple uses statements. I'd like a way to resolve only the modules for specific spi classes, not all that the dependency uses. On Mon, Jun 12, 2023, 4:56 AM Alan Bateman <alan.bate...@oracle.com> wrote: > On 11/06/2023 05:31, Josiah Noel wrote: > > I know how to use --suggest-providers as well, my issue is that it's > > tedious to have to parse the output and manually add each module. > > > > > > It'd make my workflow a lot simpler if I could just name the service > > class and have jlink resolve all the modules that provide it. > > > > As you've found, jlink doesn't do service binding by default. The > assumption is that most jlink users wants fine control over the modules > that go into the run-time image. The --suggest-providers option was to > help fine tune of service providers to specify to jlink to include. > > As has been mentioned, there is --bind-services option if needed. > Service binding is iterative to allow service provider modules > themselves make use of services. Usages of --bind-services can therefore > lead to run-time images include modules that is hard to explain, or > developers fighting the option with --limit-modules. > > I think what you are asking for is a way to do one round of service > binding. On the surface this may be okay but it might have the same > issues as --bind-services in that some developer will want all services > that provide an implementation of S except they want to exclude want P8 > and P37. P8 may be required by some other module so it can't be > excluded. It gets hard to explain. > > We went explored this area a bit in JDK 9 and converged on keeping it > simple: let someone configuring the jlink command decide which service > provide module to include. I'm not saying this shouldn't be re-visited, > just trying to summarize why it is the case. > > -Alan >