Running tomcat maven plugin in Debug mode (in STS, Eclipse and MyEclipse)

Over here I'll explain, as to how to run a tomcat maven plugin in debug mode, in Eclipse and Spring Tool Source (STS). It will be a three step setup and once you are done with the setup, you can run the tomcat server in debug mode with just one click. Following are the setup steps:

Step 1 : Entering maven dependency for tomcat in pom.xml file
Step 2 : Creating debug configuration
Step 3 : Running tomcat server in debug mode

Step 1: Entering maven dependency for tomcat in pom.xml file

Open your pom.xml file.


Enter the tomcat plugin dependency, as shown in the following figure:


Now right click on the pom.xml and select Run As à Maven Install.



Step 2 :  Creating Debug Configuration

Right click on pom.xml and select Debug As à Debug Configurations…


A Debug Configurations window will open, as shown in the following figure:


On the left hand window right click on Maven Build, as a result, following screen will get displayed:


Now select New, and following screen will be displayed:


On the right hand window provide Name as Debug Tomcat and Goals as tomcat:run, as shown in the following figure:


You also need to provide Base Directory. For setting Base Directory, click on Browse Workspace… button and the following screen will get displayed:


Select trunk and click on OK button. As a result following screen with get displayed (NOTE: In this case the workspace directory is trunk, you need to select appropriate workspace directory for your project.) :


Now select the Source tab. You will see the following screen:



Now click on the Add button. You will see the following screen:



Now select Java Project and click OK button. You will see the following screen:



Select the project,"trunk" in this case. Following screen will get displayed:



Now click the Debug button and the server will start in the debug mode.

Now you are ready to run the server anytime in debug mode. For a demo first stop the server, and follow instructions under Step 3.

Step 3 :  Running Tomcat server in Debug mode

In the IDE select Debug option and from the drop down select Debug Tomcat as shown in the following figure:



The tomcat server starts in the debug mode.
Now any time you want to run the server in debug mode you have to follow Step 3 only.


Comments

Popular posts from this blog

Spring Security - Adding more information to the authenticated user.

Hibernate Difference between update() and merge()