Search code examples
eclipsedebuggingintellij-ideapluginsxjc

Is there is a way to attach debugger to XJC Plugin? (Intellij or Eclipse)


I'm working on XJC plugin and I would like to debug it. I'm new to java and maybe I'm missing some basic stuff but I don't see how I can attach a debugger to plugin launched by xjc command line tool. Is that even possible? I .Net in VS you can attach to a process or you can event add Debugger.Launch().


Solution

  • Main credit goes to David Tiller and his article Make a Surgical Strike with a Custom XJC Plugin. Look at the project at the end of the article for Eclipse IDE.

    IntelliJ:

    1. tools.jar must be included in File -> Project Structure -> Your Project -> Dependencies dependencies

    2. Debug configuration debug configuration

    If you see XJC's output and "unrecognized parameter -XPluginName" error, check if your src folder contains META-INF\services\com.sun.tools.internal.xjc.Plugin, which has the name of your plugin's class