I would like to ask what if the property mainClassName in f.e. the build.gradle file is set automatically with the right value instead of having to be defined. In my humble opinion, it is possible to search for the one class annotated with @SpringBootApplication.

Comment From: wilkinsona

Thanks for the suggestion but we already do this in both the Maven and Gradle build plugins:

  • https://docs.spring.io/spring-boot/docs/2.4.12/gradle-plugin/reference/htmlsingle/#packaging-executable-configuring-main-class
  • https://docs.spring.io/spring-boot/docs/2.4.12/maven-plugin/reference/htmlsingle/#goals-repackage-parameters-details-mainClass

If that's not working for you and you would like us to investigate, please provide a minimal sample that reproduces the problem.

Comment From: nik-sta

Thank you for your fast and kind response. I was unaware of the existence of this feature. Tested it right now and it works fabulously.

Comment From: wilkinsona

Great. Thanks for letting us know.