How can I debug my own plugin?

I have written a plugin but it does not work. How can I debug it?

The following step-by-step description is for the Eclipse IDE but it should work similarly with other IDEs such as IntelliJ.

  • First you must build your plugin with its plugin.properties and the needed jar files. Let’s say your plugin name is MySamplePlugin.
  • Then create a new Java project for running the server in debug mode.
  • Copy the folders “core”, “lib” and “plugins” of an installation into the project root.
  • Add the file core/ClearReports.jar to the classpath of the project.
  • Stop all other Clear Reports servers. If one is running as a service then set the service to manual startup.
  • Add a launcher for the class com.inet.report.Listener.
  • Start the launcher and test in the browser if it works at this point.
  • Copy your plugin MySamplePlugin.zip into the “plugins” subfolder of the project.
  • Add to the launcher the following JVM parameter:
    -DMySamplePlugin.classpath="${workspace_loc}/MySamplePluginProj/bin"
    replacing MySamplePlugin with the id of your plugin and MySamplePluginProj with your plugin project.
  • Restart the launcher.
  • Set a breakpoint in your plugin files and call it in the browser. You may need to first set the source file location the first time you hit a breakpoint.