Create a WAR in Spring Boot and deploy it to Tomcat (Maven)

Create a WAR in Spring Boot and deploy it to Tomcat (Maven)

Make your Spring Boot web app a WAR, I made it a WAR with STS.

Add the following one line to pom.xml. (if not there)

<packaging>war</packaging>

The groupId must match the package name. For example, if the package is com.sample, set as follows

<groupId>com.sample</groupId>

If WAR is deployed in Tomcat, the following must also be added.

<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-tomcat</artifactId>
  <scope>provided</scope>
</dependency>

Right-click on the project and select “Run” – “Maven Build” to open “Edit Configuration” and enter package as the goal.

A war file will be created under the project name\target. Copy this war file to

Deployment is complete if you place this war file under tomcatwebapps and start Tomcat.

In the case of a file called sample.war, a folder called “webapps\sample\” will be created, so you can check the web application by accessing “http://localhost/sample/”.

See the reference site for details.

コメント

Discover more from 株式会社CONFRAGE ITソリューション事業部

Subscribe now to keep reading and get access to the full archive.

Continue reading

Copied title and URL