You'll want to create a configuration for Tomcat.
Select Run -> Edit Configurations
Click Add New Configuration
Select Remote
Name the Configuration
Set the Port to 8787
Uncheck Make in the Before Launch section
Uncheck Display settings before launching
Click Apply
This is as simple as creating a Remote Java Application as a Debug Configuration.
1. Drop down the Debug button, and choose the Debug Configurations... item
2. Select Remote Java Application in the Configurations list and click the New Configuration button.
3. Name the configuration.
4. Specify the project to debug (web).
5. Specify the port (8787).
6. Click Apply.
7. Click Debug.
To set up a Debug Configuration for your unit tests, specify 5005 as the port.
Be sure you have a remote configuration for Tomcat to port 8787. Repeat the steps above for creating a Remote Debugger
Run this with Maven:
mvn -Dcargo.wait=true -P int integration-test
In IDEA, select the Runtime Configuration you created from the drop down in the tool bar
Run -> Debug
IDEA will connect to the Tomcat process and display the Debug view
Debugging unit tests is very simple with Maven and Surefire. All you have to do is specify the maven.surefire.debug sytem property on the command line:
mvn -Dmaven.surefire.debug test
To specify a specific test use
mvn -Dmaven.surefire.debug -Dtest=<unqualified-classname> test