runtimeOnly dependencies are dependencies that your application needs at runtime, but not for compilation.
An example for a runtimeOnly dependency is log4j-core if you only configure it through configuration file and do not use it in your code.
If you want to exclude the runtimeOnly dependencies from installDist result, then you are most probably misusing runtimeOnly and should instead fix that, as it then is also in other places where you don’t want it.
I don’t have any configuration for installDist, nor do I have any configuration for runtimeOnly dependencies.
Unless the spring boot or kotlin plugins are doing anything to the setup, I’m not sure what misuse is happening.
You most probably apply the application plugin, which among other things configures the installDist task.
That the runtimeOnly dependencies are put to the lib folder is not the misuse. That is perfectly fine and exactly what runtimeOnly is for as I explained above.
If you declare dependencies as runtimeOnly that you do not want in the lib folder and thus not available at runtime, that would be the misuse.
I need those runtimeOnly dependencies for local development, they need to be available when I run the application locally, and they should not be included in installDist.
Well, the right solution heavily depends on the details.
If you for example use the run task for the “local development run”, then you should probably create a new configuration, declare those dependencies on that configuration and then wire it into the run task.
This is not too helpful, it just makes sure that all the dependencies declalred in runOnly are downloaded or built, but you don’t use them anywhere. Besides that practically any dependsOn that does not have a lifecycle task on lhe lefthand side is not the right thing to do.
Actually, no.
The configurations block you have there within the run configuration does not configure the run task. If you would want to have that, you should have it outside the run configuration. But that block is anyway not what you want, because you now just duplicated the runtimeOnly configuration. You configured the runtimeClasspath to also have all dependencies you declare on runOnly, so they will again land in your final distribution.