springboot multi-module project, run in the tomcat

springboot multi-module project, you need to run under tomcat server, we must first item labeled as war package, pom modify files in the web module, will be packaged in the form of war completely changed the package (default is jar package)

1. Modify the pom file web-api project

 

 2. Modify the project root pom file, removing springboot comes with tomcat

 

 

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>

<groupId>javax.servlet</groupId>
    <artifactId> the javax.servlet-API </ artifactId> 
<scope> Provided </ scope>
</ dependency>

add servlet rely

3. Start a new startup class under similar directory, tomcat deployed to solve the access issue 404

 

 After more things right, terminal run mvn clean package, Packaging Success, will be able to see the war package in the target directory

 

Guess you like

Origin www.cnblogs.com/hooli/p/11876242.html