views:

112

answers:

2

I've written a plugin for Maven2 in Eclipse.

How can I run the plugin in debug mode in Eclipse?

If possible, I'd like to avoid remote debugging an external process and I'd also like to avoid installing plugins into Eclipse.

A: 

Make sure that "workspace resolution" is enabled for the project you're running the plugin from, then right click on this project and select Debug As > Maven build...

Alison
This requires the m2eclipse plugin I think. I'm actually looking for a solution that doesn't require me to install any eclipse plugins.But thanks anyway.
James Blewitt
Is there any reason why you wouldn't install the m2eclipse plugin? I'm not sure how you can run Maven inside Eclipse without using it, and it will certainly make things easier in this case.
Alison
Im trying this out, but it doesn't seem to work.My project is a maven plugin. I have a second project that I want to execute my plugin on (lets call it "test project").If I do "Debug As -> Maven Build" from my plugin project and then set the base directory to "test project", it does indeed execute my plugin on the test project.The trouble is that it ignores all my breakpoints in my plugin code.I have the feeling that it is just getting my plugin out of the local repository and is ignoring my eclipse code.Am I doing something wrong?
James Blewitt
Hi James, sorry this isn't working. You may have more luck with the "generic approach" here http://docs.codehaus.org/display/MAVENUSER/Dealing+with+Eclipse-based+IDE
Alison
Thanks for all the help.In the end I settled with remotely debugging a maven build.If you start maven using "mvnDebug" instead of "mvn" it will pause at start up waiting for the debugger to connect.I can then connect to it using Eclipse and debugging works fine.It's not perfect, but isn't as bad as I originally imagined.
James Blewitt
Very interesting, thanks for passing that on - no doubt I'll have to revisit this sometime.
Alison
A: 

It is possible to debug integration/functional tests. See the following resources:

Just in case (and for other readers), the wiki page Dealing with Eclipse-based IDE explains how to remote debug an external Maven process (not sure why you want to avoid this).

Pascal Thivent