Monday, March 8, 2010

Debug Maven project in Eclipse



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.
Happy debugging!

(I used Eclipse 3.4, Maven 2.2.1 and Maven Integration for Eclipse)

6 comments:

Камков Вячеслав said...

Great instruction! Thanks a lot!

Anonymous said...

Good work!

Anonymous said...

Hey, that was really helpful :)
Thanks. . .

Anonymous said...

Great! Very helpful & straightforward!

Anonymous said...

that was really helpful :)
Thanks. . .

Anonymous said...

Thanks a lot.
Could you also tell me how to set it if i want to debug on 2 maven projects of which one is dependent on other.