Thursday, June 28, 2007

Debugging Custom Maven Plugins

What you need:

How to:

Code Snippets and Todos for debbuging:

  1. Write a custom Maven Plugin! (@see code snippet 1)
  2. Write a Maven Project which uses your maven-plugin (@see code snippet 2)
  3. Install everything in your local maven repository (mvn clean install)
  4. Set a breakpoint in your custom maven plugin. (@see code snippet 3)
  5. Open the debug-view in Eclipse (@see pic 1)
  6. Invoke your plugin's sayhi-goal in your maven project via m2eclipse-plugin by configuring it over the external tools settings in Eclipse. (@see pic 2)
  7. Eclipse then will automatically stop where you have set your breakpoint! (@see pic 3)

Code Snippet 1:

Code Snippet 2:

Code Snippet 3:

Pic 1:



Pic 2:

Pic 3:



How cool is this!! Finally, you don't have to System.out.println everything to check your custom maven-plugins' variables. Very, very helpful !!!

Cheers

No comments: