springBoot deployment jar, war

1. jar package deployment

maven插件:
<build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build>
If you do not add plug-in, on the implementation of the jar package 
the Java - JAR xxx.jar 
error message: no main manifest attribute, in xxx.jar

If you have installed maven maven package directly on the line

The directory structure of the jar package

example.jar
                     |
                     +-META-INF
                     |  +-MANIFEST.MF
                     +-org
                     |  +-springframework
                     |     +-boot
                     |        +-loader
                     |           +-<spring boot loader classes>
                     +-BOOT-INF
                        +-classes
                        |  +-mycompany
                        |     +-project
                        |        +-YourClasses.class
                        +-lib
                           +-dependency1.jar
                           +-dependency2.jar
https://docs.spring.io/spring-boot/docs/2.1.0.BUILD-SNAPSHOT/reference/htmlsingle/#executable-jar-jar-file-structure

2. war package starts

1) in the form of packaged jar pom.xml modified to war <packaging> war </ packaging>

2) Construction of the project name in <bulid> inside <finalName> xdclass_springboot </ finalName>

3) placed inside webapp inside tomcat

4) modify the startup class

// 进行初始化
public
class WebApplication extends SpringBootServletInitializer { @Override protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { return application.sources(WebApplication.class); } public static void main(String[] args) throws Exception { SpringApplication.run(WebApplication.class, args); } }

5) packing, start







Guess you like

Origin www.cnblogs.com/sjzxxy/p/12597602.html