Hi,
I went through the guide for plugin development.
What is the approach to debug already existing plugins?
I referred to this gist as it has a section for debugging.
However the approach doesn’t work when the plugin itself has dependencies.
For example: if I try to debug Openfire Meeting plugin with the approach in the plugin development guide,it throws an exception.
What is the ideal way to debug plugin with dependencies in IntelliJ Idea?
1 Like
Hello,
I could debug broadcast plugin very now. Probably, I will avoid turning off my computer in the next weeks.
Having Openfire already setup in you editor, I did the following:
- Cloned broadcast plugin in a different folder;
- Open Module Settings (F4)
- Click on the + signal, somewhere on the top of Module Settings Window
- Then, click on Import Module
- Select the plugin folder (Broadcast in this case)
- Click on Maven
- And then finish
- On command line, build the plugin with mvn verify in the plugin folder
- Copy the Jar file to Openfire plugins folder, (My case:
cp broadcast/target/broadcast-openfire-plugin-assembly.jar src/distribution/target/distribution-base/plugins/broadcast.jar
)
- Then put your breakpoints
- Run openfire with debug options
java -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005 -Dlog4j.configurationFile=/opt/openfire/distribution/target/distribution-base/lib/log4j2.xml -server -DopenfireHome="/opt/openfire/distribution/target/distribution-base" -Dopenfire.lib.dir="/opt/openfire/distribution/target/distribution-base/lib" -classpath "/opt/openfire/distribution/target/distribution-base/lib/startup.jar" -jar "/opt/openfire/distribution/target/distribution-base/lib/startup.jar"
(These paths are related to openfire inside my Docker container, /opt/openfire will be different for you)
12) Click on Debug on IDEA … you might have to setup some options there
13) Access something in Openfire to see if the breakpoint activate
I’m not a Java developer, so these steps might be longer than the desirable. Copying jar each time you change the plugin source might be a nightmare. I hope someone has a better way to do that.