Community Post

Eclipse tomcat deployment with grunt/gulp build

💬 comments

This blog will show how you can deploy your apps on tomcat using eclipse having grunt/gulp build for UI elements.

So what we will be actually doing here is 1. Deploy the UI components on default Tomcat webapp directory. 2. Deploy the class files on "wtpwebapps" (default directory for uploading war through eclipse) directory. So that the UI components not replaced by src/main/webapp contents on each tomcat deployment.

Setting Eclipse

  1. Go to server tab, open properties for tomcat
  2. Make sure, the location should be [workspace metadata]
  3. Then double click on tomcat to open Tomcat overview.
  4. Set server location to "Use tomcat location".

Grunt/Gulp Setting

  1. Use the copy task to copy the build UI file to<tomcat installation directory>/webapps/<contextRoot>/

HotDeploy setting

This can help in replacing the code on tomcat server without actually restarting the server.

  1. Open Tomcat overview by clicking on "tomcat" under server tab.
  2. Under publishing, Select "Automatically publish changes"
  3. Now go to modules tab, Edit your web module and Unchech auto reload.

NOTE This will work in DEBUG mode only.

Table of Contents