How to Deploy Spring Project to Live Server

Assuming you have created a dynamic web project under Eclipse, and you have tested your project, now you want to deploy the Spring project to a live server. The project runs on Tomcat and it interacts with MySQL database. How to correctly deploy your project?

To deploy the project, you need to build a .war file. a .war file (Web application ARchive) is a JAR file used to distribute a collection of Java classes, XML files, libraries, static web pages and other resources that together constitute a web application. You can build a .war file in Eclipse very quickly. Right click on the project, Click “Export”, and choose war file in the dialog.

eclipse-export-war

eclipse-deploy-war

After the .war file is generated, you can manually copy the .war file to the server directory, i.e. $TOMCAT_HOME/webapps directory. You can also use Tomcat “Manager” application.

If you have a dedicated server, you should also set up the server and database first.

1 thought on “How to Deploy Spring Project to Live Server”

Leave a Comment