- Yair Mark
Today I was trying to use a Maven plugin that was misbehaving. I tried the usual things like add debug and error logging using the
-e flags respectively but still had no luck. I then tried to see if I could add the sources for the plugin as a library in IntelliJ. I managed to find the sources using the library search tool searching using the form
groupId:artifactId:version and IntelliJ added it but complained about having more than one source root so I cancelled the operation.
In the end I cloned the project and added it to the one I was trying to debug the plugin in:
- Go to
- Then click the green plus
- Choose the pom file from the root directory where you cloned the plugin source code
Right, now I had the sources but still had to workout how to run the plugin in debug mode. Maven jobs in IntelliJ can be run in debug mode by clicking the little bug icon, so I tried modifying the goals to rather be the plugin I wanted but this did not run in debug mode as I would have expected.
After Googling a bit I found 2 ways to do this:
- Open the
- Expand the plugins section
- Find the plugin you want, right click it and choose
The other option if your IDE does not have this is
- Setup a remote configuration
- Use port
- Make sure the debugger is set to
- Use the
- Then run your plugin using
- So for example if you normally run
mvn yourPluginyou just swap
mvnDebugthen quickly click run for your remote configuration
Whichever option you choose if you put breakpoints anywhere in the plugin source code you will hit those breakpoints.