Debug a maven plugin’s execution in a maven web-project

debuggingmaven-2

Is there any way to actually debug a maven plugin while it is in action. What I mean is that for example we have the maven-clean-plugin. So when this plugin executes it's action can we somehow debug and check inside the source code of maven-clean-plugin?

Obviously we would have to associate the Java source for the plugin in eclipse but how can we set it for debugging?

Thanks.

EDIT: Changing the subject
I'm sorry guys maybe I should have been more precise. Actually I have my web-app which is a maven project, which makes use of 3rd party maven plugins. Now when I do a mvn clean install I need to debug my 3rd party maven plugin. Now in my maven dependency I dont get a dependency to that plugin jar, which is quite normal. Any ideas?

Best Answer

If you are using Eclipse with the m2eclipse plugin, simply launch your build with Debug As... instead of Run as....

If you are not using m2eclipse, run mvnDebug instead of mvn (for Maven 2.0.8+) and attach a remote debugger on port 8000. For Maven 2.0.8<, add the remote debuggin options to the start script.

Of course, you need to import the sources of the plugin in your workspace.

See also