Web Application Deployment Options Explained | Generated by AI

Home 2025.09

Got it — let me explain those options clearly for you.

This is the easiest way to start the project during development. If your pom.xml includes a Tomcat or Jetty plugin, you can run the app directly with:

mvn tomcat7:run

or

mvn jetty:run

This launches the web app in an embedded Tomcat/Jetty without building a WAR or deploying manually. If you don’t already have the plugin, you’d need to add it to pom.xml first.


Option 2: Build and Deploy WAR

This is the more “traditional” approach. You package the application into a WAR file:

mvn clean package

This produces something like target/playground-server-1.0.war. You then copy that WAR into a standalone Tomcat/Jetty server’s webapps/ folder, restart the server, and access the deployed app in the browser.


Option 3: Use Embedded Server (Manual Setup)

Currently your Application.main() just starts the Spring context — it doesn’t actually start a web server. If you want the app itself to launch Tomcat (without relying on an external one), you’d need to modify your main class to set up and start an embedded Tomcat instance programmatically.

This gives you a self-contained runnable JAR, but it requires extra setup code.


Option 4: Spring Boot Migration

This project has some Spring Boot test setup, but isn’t a real Spring Boot app yet. That’s why running:

mvn spring-boot:run

doesn’t work.

If you want, you can migrate:

This is the most modern approach, but requires some changes to your code and pom.xml.


In short:


Do you want me to show you the exact pom.xml snippet for Option 1 (Tomcat/Jetty plugin) so you can just run mvn tomcat7:run right away?


Back Donate