Debugging a Plugin Using IntelliJ IDEA
To use IntelliJ IDEA to debug problems in the code of a plugin without having to re-bundle the
plugin's Java classes in a JAR library,
follow these steps:
- Download and install Oxygen XML Author.
- Set up the Oxygen SDK following this set of instructions.
- Create a Java Project (for example, MyPluginProject) from one of the sample plugins (for example, the Workspace Access plugin).
-
In the MyPluginProject folder, create a folder called myPlugin. In this new folder, copy the plugin.xml file from the sample plugin. Modify the added plugin.xml to add a library reference to the directory where IntelliJ IDEA copies the compiled output. To find out where this directory is located, go to . Then select the Modules category and inspect the value of the Output path text box from the Path tab.
Example: If the output path is C:/Users/myUser/Documents/MyPluginProject/target/classes, then in the plugin.xml, you need to add the following library reference in the runtime element:<library name="../target/classes"/>
- Copy the plugin.dtd from the [OXYGEN_INSTALL_DIR]/plugins folder in the root MyPluginProject folder.
- In the MyPluginProject dependences ( ), add external JAR references to all the JAR libraries in the [OXYGEN_INSTALL_DIR]/lib folder. Now your MyPluginProject should compile successfully.
- In IntelliJ IDEA, create a new Java Application
configuration for debugging (Main class box to
ro.sync.exml.Oxygen
and add the following code snippet in the VM options input box, making sure that the path to the plugins directory is the correct one:-Dcom.oxygenxml.app.descriptor=ro.sync.exml.EditorFrameDescriptor -Dcom.oxygenxml.editor.plugins.dir=D:\projects\MyPluginProject
Note: If you need to configure the plugin for Oxygen XML Author, set thecom.oxygenxml.app.descriptor
toro.sync.exml.AuthorFrameDescriptor
.
). Set the