Dealing with Eclipse-based IDE
Table of Contents
- Introduction
- Openning your Maven Project in Eclipse
- Running your Maven Project in Eclipse
- Debugging your Maven Project in Eclipse
- Generic Debugging
- Surefire Debugging
Introduction
TODO
Openning your Maven Project in Eclipse
TODO
Running your Maven Project in Eclipse
TODO
Debugging your Maven Project in Eclipse
Note that there two debug modes in maven (AFAIK): the generic, and the surefire. You'd need a different approach with the surefire debugging since it forks your tests in another jvm.
Generic Debugging
- Setting up Maven
- open %M2_HOME%/bin/mvn.bat
- At line 30 (more or less), you'll find this, "@REM set MAVEN_OPTS=-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000". Delete @REM (Thus, uncommenting that line)
- save that file as mvn-dbg.bat (or any convinient name you may want). You now have to maven batch files, one for normal use, and one for debugging.
- Run your maven command but use "mvn-dbg" instead of "mvn" (i.e. instead of "mvn install", use "mvn-dbg install")
- From your Eclipse,
- Select break points in the code you're running.
- Run > Debug > Remote Java Application > New Launch Configuration > Debug
- Select the maven project that you wish to step through, and set "Port" to 8000 (the default, unless you modified that part of the mvn batch/script file)
- Press "Debug" button to start debugging
Debugging your Tests
- From your command line,
- Append -Dmaven.surefire.debug to your maven command (i.e mvn install -Dmaven.surefire.debug).
- Wait for your maven to pause its execution and display the message, "Listening for transport dt_socket at address: 5005".
- From your Eclipse,
- Select break points in the code you're running.
- Run > Debug > Remote Java Application > New Launch Configuration > Debug
- Select your Project, and set "Port" to 5005
- Press "Debug" button to start debugging
Labels
