I'd like to use boot run to run an application that lives in a gradle feature variant
https://docs.gradle.org/current/userguide/feature_variants.html
My personal rationale is that I wanted to spin up a dev server just for this particular controller vertical slice. Since devtools doesn't work on test runtime, and I don't want to publish this, it seemed like a good idea to make a variant. Unfortunately I couldn't find any way to configure spring boot to do this, I tried using the source sets method, but I don't think that's what it's designed for.
I could see wanting to do this for any vertical in a monorepo.
side comment, and I can open another bug on this. From the existing documentation I wasn't able to figure out how to turn off dependency management whilst getting boot run, and the plugin was unhappy that I was in a java-library.
Comment From: philwebb
The BootRun task extends Gradle's standard JavaExec task which does most of the heavy lifting. I'm guessing that it's possible to add an instance of the task and update the classpath that it uses, but I'm not sure exactly how.
The DefaultJvmFeature class inside the Gradle codebase creates new jar tasks based on the feature name (see this code). I'm guessing we could do something similar to create distinct bootRun tasks (if we can work out how to configure them).
Comment From: philwebb
We discussed this today and we don't want to attempt to auto-configure different BootRun tasks based on feature variants. Our recommendation is to configure the tasks needed directly.
Comment From: xenoterracide
and how do you do that? as far as I can tell, there isn't a way to tell boot run what source set the main class lives in. Wasn't asking for auto-configure... just configure
Comment From: wilkinsona
Our plugin configures the default BootRun task like this:
https://github.com/spring-projects/spring-boot/blob/f896ce711f1f3432931dcbb6bca076f870b26ed6/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/plugin/JavaPluginAction.java#L201-L213
Hopefully you can use that as inspiration for something that meets your needs.