Recently I read the instruction about debugging Maven project in Eclipse http://docs.codehaus.org/display/MAVENUSER/Dealing+with+Eclipse-based+IDE
It mentioned that you need to create a Java project (e.g. "Maven Debug") in order to attach the debugger. I found this unnecessary and you don't have to create such additional project. Here is how:
- Click "Run" -> "External Tools" -> "External Tools Configurations..."
- Create new configuration.
Where maven_exe points to your Maven installation folder. Click "run" and you should see in the console that it launched the debugger, listening to port 8000.
- Now go to "Run"-> "Debug Configurations..." and create a new "Remote Java Application":
- On "connect" tab, set project to your Eclipse project you want to debug. Host = localhost, port = 8000.
- On "Source" tab, add your Eclipse project as the source lookup path
- Finally, click "debug" and it will stop at your breakpoints.
(I used Eclipse 3.4, Maven 2.2.1 and Maven Integration for Eclipse)