Spring boot packaging war jar deployment Tomcat
summary
1. Spring boot aggregation project packaging War deployment Tomcat
2. Spring boot packages jar and runs it directly through Java - jar
3. Provide complete POM XML test project to GitHub
solve the problem
1. There is no main list attribute in XXXX
2. Solve the problem of no web XML and an error is reported
[ERROR] Failed to execute goal org. apache. maven. plugins:maven-war-plugin:2.2:war (default-war) on project provider: Error assembling WAR: webxml attribute is required(or pre-existing WEB-INF/web.xml if executing in update mode) -> [Help 1]
edition
1.JDK 1.8
2.Spring Boot 1.5. eight
3.apache-tomcat-8.5. twenty-three
I
Packaging war and deploying Tomcat
1. Rewrite app class to inherit springbootservletinitializer
2. Rewrite the configure method and return builder sources(YouApp.class);
3. Add POM XML, as shown below
4. Modify < packaging > war < / packaging >
5. Package command
6. Refer to GitHub -- > releases -- > v0 1, which is a complete project configuration that can package jars and run through Java - jar
Address: https://github.com/mmdsyl/BLOG-Microservice/releases
II
Package jar execution run
1. For standard applications, do not inherit springbootservletinitializer
2. Modify POM, as shown in the figure
3. Package command
4. Refer to GitHub -- > releases -- > v0 Blog main web in 1.1, which is a complete configuration in packaged war deployable Tomcat
Address: https://github.com/mmdsyl/BLOG-Microservice/releases
summary
The above is the spring boot packaging war jar deployment Tomcat introduced by Xiaobian. I hope it will be helpful to you. If you have any questions, please leave me a message and Xiaobian will reply to you in time. Thank you very much for your support for the programming tips website!