Tomcat Maven Deployment in Eclipse

You will get 404 error when you deploy the imported maven web application into tomcat. so first time you need to run the maven command to load eclipse deployment settings to project. There are two ways you can configure this

  1. Import the project.  In this case i imported projectrun maven project on tomcat using eclipse
  2. Open the Command prompt and navigate the project folder.
  3. Run the command to update project settings : mvn eclipse:eclipse -Dwtpversion=2.0
  4. In this case, I ran the command at the project folder    D:\java_work\workspace\spring-rest-hibernate>mvn eclipse:eclipse -Dwtpversion=2.0
  5. Clean Tomcat Server Directory 
  6.  Right Click On project and click on Run on Server

Option 2: This is not recommended option that you always need to run the command to take affect the code changes. In this option you need to point the document base to maven generated war folder.   Click on Tomcat under servers and click on Modules tab. Click on “Add External Web Module and  update the

Document Base: D:\java_work\workspace\spring-rest-hibernate\target\spring-rest-hibernate

Path : spring-rest-hibernate  (You can give any context path here,but make sure that you are accessing context specified here)


Finally the simple way is, copy the generated war file to tomcat/webapps folder 🙂 🙂

Leave a Comment

Your email address will not be published. Required fields are marked *