There three launcher in Spring Boot: JarLauncher/PropertiesLauncher/WarLauncher. For executable jar, JarLauncher will be used by default. Now I want to use PropertiesLauncher instead so that I could use external classpath. How could I specify that is spring boot gradle plugin?
Accoring to D3.1 of this doc D.3.1 Launcher manifest, I can specify the main class in MANIFEST.MF like this:
Main-Class: org.springframework.boot.loader.JarLauncher
Start-Class: com.mycompany.project.MyApplication
However, in Spring Boot Gradle, the following code snippet actually specifies the Start-Class, not the Main-Class:
springBoot {
mainClass = "com.sybercare.HealthServiceApplication"
}
Do I need to create the MANIFIEST.MF manually or there is a better way to do this?
Thanks!
When we apply the java plugin, the Spring Boot Gradle plugin takes multiple actions like: creating a bootJar task, which we can use to generate an executable jar file. creating a bootRun task, which we can use to run our application directly. disabling jar task.
The Spring Boot gradle plugin provides the bootRun task that allows a developer to start the application in a “developer mode” without first building a JAR file and then starting this JAR file. Thus, it's a quick way to test the latest changes you made to the codebase.
One example of this is the build system. A change to the build system affects those that contribute to the project but, if we get things right, it has no effect on users. This has led to a mixture of Maven- and Gradle-based builds. For example, Spring Framework has been built with Gradle since 3.2.
Add the layout
property:
springBoot{
mainClass = "com.sybercare.HealthServiceApplication"
layout = "ZIP"
}
layout = ZIP
Triggers SpringBoot to use the PropertiesLauncher
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With