Specify main class Spring-Boot command line

前端 未结 3 1733
-上瘾入骨i
-上瘾入骨i 2021-02-01 06:11

I use maven plugin to set the main class like this :


org.springframework.boot
spring-boot-maven-p         


        
3条回答
  •  青春惊慌失措
    2021-02-01 06:56

    Executing from Windows PowerShell I needed this format (with the quotes):

    java -cp .\myjarfile.jar -D"loader.main=com.app.etc.FullyQualifiedMainClass" org.springframework.boot.loader.PropertiesLauncher

    To clarify the accepted answer: You can directly modify the loader.main property in the jar's META-INF/MANIFEST.MF file, if you're ok with a more static solution.

提交回复
热议问题