The spring-boot:run goal allows the test classpath to be used and for a custom main method to be specified but this currently doesn't work when using a SpringApplication.from(...) main method in src/test/java.
I think it's because we have the test dependencies but not our own test classes.
Comment From: snicoll
Is this how we want to support this? If we add the app's test classes, then the main class detection logic will fail as it'll find two classes with a main method, isn't it?
Creating a new goal is relatively cheap (although the class hierarchy makes me cringe a bit already) but I don't know how I'd name it. Perhaps an attribute on run that states we're looking for the "test app"?
Comment From: snicoll
(It probably isn't a task btw).
Comment From: snicoll
Given #35248, it looks like a spring-boot:test-run goal could be an option.
Comment From: wilkinsona
I have the beginnings of something in this branch. There's a new TestRunMojo that, like StartMojo and RunMojo, extends AbstractRunMojo. Unfortunately, this means that the new test-run goal suffers from the problems described in https://github.com/spring-projects/spring-boot/issues/35250. It would be good to address those problems rather than adding to them but time is really tight.