Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deploying Spring MVC project

I've developed a small MVC project using Spring MVC, Hibernate, MySQL, Maven and Tomcat. I can run and test the application (locally) smoothly.

Now I need to publish/deploy this project on an (online) server that have only Tomcat installed on it. How can I publish/deploy the project online? Is there any special build I should do? What files I shall upload and to where?

like image 414
MChan Avatar asked Sep 22 '13 11:09

MChan


People also ask

Is spring MVC still used?

Yes. Whenever someone uses Spring Boot for creating RESTful web services, chances are they are using Spring MVC (part of Spring Web starter, see http://start.spring.io and search Web in dependencies) although Spring has also been offering another web framework, Spring WebFlux.


1 Answers

There are several types of development options available.

For development on localhost EAR (Exploded ARchive) type of project is usually used (because you can easily make hot deploy on servery). But for production WAR (Web ARchive) is used (basically it's the same EAR archive, but compressed using ZIP algorithm).

If you want to deploy your project to remote Tomcat server then make your project as WAR archive and upload it to Tomcat's webapps directory. Then you might need to restart Tomcat. But it's manual way of deploying.

Better option is to use automated build tools (like Maven) which can compile your project, run unit tests, deploy on web server (local or remote) etc.

This one is a great example of how to deploy your project on Tomcat server by using Maven's tomcat-maven-plugin: http://www.mkyong.com/maven/how-to-deploy-maven-based-war-file-to-tomcat/

Good luck ;)

like image 86
Ernestas Kardzys Avatar answered Oct 31 '22 12:10

Ernestas Kardzys