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
- Import the project. In this case i imported project
- Open the Command prompt and navigate the project folder.
- Run the command to update project settings : mvn eclipse:eclipse -Dwtpversion=2.0
- In this case, I ran the command at the project folder D:\java_work\workspace\spring-rest-hibernate>mvn eclipse:eclipse -Dwtpversion=2.0
- Clean Tomcat Server Directory
- 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 🙂 🙂
Comments are closed.