Local debugging of plugins in Enonic CMS 4.7

I need to debug a plugin for enonic 4.7.

The plugin is deployed as a .jar file in the /plugin directory as per the docs. Is there any way to attach a debugger (intellij) to a plugin when running enonic cms locally?

Yes. There is.

You need to start you local instance of Enonic CMS with a debug port open. Then, Intelli/J can attach to that port.

This is done by creating a “Remote” debug configuration in Intelli/J. Intelli/J will then show you the command line argument you need to use on the command that starts Enonic CMS, and after you start Enonic CMS with this argument, Intelli/J can attach to the process. For instance, if you use port 5005 which seem to be a default debugging port, you need to add -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005 to the command that starts Enonic CMS.