Monday, February 4, 2013

Maven: debugging

If you've ever been in the situation that you'd need to debug maven build, these are the options that could help.

Debugging maven run

If you need to debug maven plugins run itself use instead of standard:
mvn <your sfuff>
the debug one:
mvnDebug <your sfuff>
It should tell you it's waiting for connection, in a way like this:
Preparing to Execute Maven in Debug Mode
Listening for transport dt_socket at address: 8000
Afterwards use your preffered way to connect to socket 8000 via remote debugger. (For eclipse steps can be found here, or googled)

Debugging test execution

If you need to debug maven-surefire-plugin run use following:
mvn -Dmaven.surefire.debug test
It would wait for connection, in a way like this:
Listening for transport dt_socket at address: 5005
Afterwards use your preffered way to connect to socket 5005 via remote debugger. (For eclipse steps can be found here, or googled)
Easy, isn't it?

2 comments:

Sekh said...

Hey Peter , I am into Maven for the last one week.But on windows using m2e on eclipse. Built a few projects and checked-in to git.Still figuring things out.Might need your help :-)

Peto B said...

Hi Sekh, m2e is the right choice for eclipse. sure, feel free to ask.