How to solve the problem of SpringBoot packaging jar runtime prompting that there is no main manifest attribute
What this article shares to you is about how to solve the problem that there is no main list attribute when SpringBoot packaging jar is run, the editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article.
SpringBoot Packaging jar Runtime prompts that there is no main manifest attribute problem
With regard to the problem that there are no main list attributes when springboot is packaged into a jar file and then run the java-jar command, there are many solutions on the Internet, and the most embarrassing thing is that it doesn't work well, let's do two that work today.
The first option, org.springframework.boot spring-boot-maven-plugin repackage
And then
# switch to the subproject and execute the packaging command $cd test-package & mvn package second solution org.springframework.boot spring-boot-maven-plugin
To skillfully use IDEA, select the project first, and then
The final result
$java-jar test-package-1.0-SNAPSHOT.jar. _ _ / / _ _ _ (() _ _ _ |'_ _ _ | |\ / _ _ _ | | | (_ _ | |) )'| _ |. _ _ | _ | | _ | _ | | _\ _ _ | | / = | _ | _ | = | _ _ / = / _ /:: Spring Boot:: (v2.3.3.RELEASE) 2020-09-28 16 purge 58 Spring Boot 08.980 INFO 23124-[main] test.PackageApplication: Starting PackageApplication on DESKTOP-4G39J2B with PID 23124 (\ demo-project\ test-package\ target\ test-package-1.0-SNAPSHOT.jar started by idea in\ demo -project\ test-package\ target) 2020-09-28 16 Flux 58 INFO 08.983 INFO 23124-[main] test.PackageApplication: No active profile set Falling back to default profiles: default2020-09-28 16 main 58 INFO 09.937 INFO 23124-[main] o.s.b.w.embedded.tomcat.TomcatWebServer: Tomcat initialized with port (s): 8080 (http) 2020-09-28 16 falling back to default profiles 58 Swiss 09.951 INFO 23124-[main] o.apache.catalina.core.StandardService: Starting service [Tomcat] 2020-09-28 1658 Fringe 09.951 INFO 23124-[ Main] org.apache.catalina.core.StandardEngine: Starting Servlet engine: [Apache Tomcat/9.0.37] 2020-09-28 16 INFO 58 INFO 23124-[main] o.a.c.c.C. [tomcat]. [localhost]. [/]: Initializing Spring embedded WebApplicationContext2020-09-28 16V 58 INFO 10.017 INFO 23124-[main] w.s.c. ServletWebServerApplicationContext: Root WebApplicationContext: initialization completed in 977 ms2020-09-28 16 ms2020 58 INFO 23124-[main] o.s.s.concurrent.ThreadPoolTaskExecutor: Initializing ExecutorService 'applicationTaskExecutor'2020-09-28 16 ServletWebServerApplicationContext 58 INFO 10.323 INFO 23124-[main] o.s.b.w.embedded.tomcat.TomcatWebServer: Tomcat started on port (s): 8080 (http) with context path' 2020-09-28 16:58:10. 331 INFO 23124-[main] test.PackageApplication: Started PackageApplication in 1.7 seconds (JVM running for 2.068) 2020-09-28 16 test.PackageApplication 52.704 INFO 23124-[extShutdownHook] o.s.s.concurrent.ThreadPoolTaskExecutor: Shutting down ExecutorService 'applicationTaskExecutor'
In fact, the basic principle is the same, first call package and then call spring-boot:repackage 's plugin, after testing, these two solutions can indeed correctly complete the packaging of springboot.
The above is how to solve the problem of SpringBoot packaging jar runtime prompt that there is no main list attribute. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.