Code change is not being reflected in the idea plugin Follow
I am developing an Intellij plugin (tutorials) which shows the current git branch in the notification. Below are the steps I followed to develop the plugin.
- Create a plugin project, add JDK and IntelliJ SDK. Add IntelliJ source to the SDK.
- Make the project
- Debug the plugin, it opens up a new instance of Intellij IDE where I open the new project and I can see the notification of the current git branch. Till now I can debug the plugin properly.
Now I did few of the code changes, saved and make the plugin again. Now If I debug the plugin
- the changes are not being picked up.
- The debug lines are referring to older code only though there is not old code present in the IDE as I already modified the code.
- Even the exceptions thrown at some particular line is wrong as I can see if I click the exception prone lines it takes me to completely different line (blank line, closing curly brace etc. i.e some random lines)
I appreciate your help.
Please sign in to leave a comment.
I'm having what seems to be the same problem. I can run the plugin project but it doesn't seem to use any changes I made to the code, even after various combinations of Make Project, Make Module, Rebuild Project, etc. However, I did find a workaround that may help you. In short, you have to uninstall your plugin, restart the IDE, shut it down, and then if you run it again it'll pick up your changes. Here's a detailed list of the steps that works for me:
To get it to pick up your changes, do this:
In other words, IDEA has to be rerun twice to pick up your changes: once after the removal of the plugin, and a second time after that when you run it with the updated plugin code; if you skip the extra restart it won't work.
It's annoying to have to do this every time I want to test a change in my code, so if anybody knows of a better / faster way then please let me know.
Also, though I don't know if this is relevant or not, I should mention that I'm using (Community Edition) version 15.0.6.
it is possible to run a plugin you work on, without installing it:
select "Plugin" run/debug configuration, then click run button.
When upgrading plugin to a new version, it is not necessary to uninstall the previous one. Simply install over the old one (as per first time install) and restart Idea once.
"it is not necessary to uninstall the previous one"
It is necessary with the version of IDEA I'm using for the plugin development. In fact, it's not only necessary to uninstall the plugin, but after that IDEA has to be restarted for the removal of the old plugin code to be completed. Only after the uninstall / restart am I able to shut down IDEA, make changes to my plugin code, restart IDEA again, and have it pick up my changes. If you're seeing different behavior then I'd guess you're using a different release, but I do know that what I described is necessary for me. Trust me: I wish it weren't necessary, but it is.
Your mention of being able to "install over the old one" makes me think you've misunderstood what we're discussing here: no explicit installation is ever needed / performed during plugin development. I -- and I suspect the OP -- use a plugin run configuration to start a new secondary instance of IDEA, which automatically includes the plugin without it ever being explicitly installed.
I should probably clarify, too, that when I refer to needing to "restart IDEA", I'm referring to restarting that secondary instance created by executing the plugin run configuration.
> restarting that secondary instance
yes I thought you'd referred to the main "non-plugin-dev" instance.
well secondary instance needs to be restarted if you change plugin code. I am not sure if this is possible at all for plugin code changes to be reflected in the secondary running instance.
this should not be necessary to install / uninstall plugin in the secondary instance at all. You may try to do this but it should work without this extra step.
BTW when launching the secondary instance, is the "released" plugin installed in the main instance? I am not sure if the main plugin is loaded when secondary Idea instance runs with the dev plugin version. It probably is not but it may be worth to try to ununistall "released" plugin from the main instance when working on the same plugin in the secondary instance.
"well secondary instance needs to be restarted if you change plugin code"
Sure, that part didn't surprise me at all. What did surprise me is that I actually have to restart it twice: once after uninstalling the plugin, and a second time after that for it to pick up my plugin code changes.
"when launching the secondary instance, is the 'released' plugin installed in the main instance?"
No, I've never installed the plugin I'm working on into my primary IDEA installation.
> once after uninstalling the plugin, and a second time after that for it to pick up my plugin code changes.
what happens if you do not uninstall the plugin but instead:
are changes picked up then?
@Imants No it's not picking up the code changes.
@Justin: Thanks your approach helped but I wonder why so much work needs to be done instead of live reload. I would like to see plugin development as easy as Atlassian Plugin development from the IntelliJ.
Thanks everybody for your valuable reply.
> Add IntelliJ source to the SDK
are you changing your plugin code or Intellij code?
If changes are made to Intellij code, I have no idea how this is supposed to work.
If this is plugin code, in my experience plugin code is reloaded and debuggable on simple 2 instance restart. In the beginning I tried to uninstall plugin in 2 instance but then it seemed unnecessary.
Here's an update for Vikash or anyone else who may find this helpful: I just discovered that this behavior doesn't occur in an earlier release of IntelliJ, specifically in 12.1.8. In other words, in 12.1.8, any changes I make to my plugin code are immediately reflected when I start an instance of IntelliJ to test the plugin code, and there's no need for the extra shutdown / restart that I described earlier.
And again, to avoid any configuration, I'm not referring to an explicitly install plugin, but rather to starting a secondary instance of IntelliJ using a plugin Run Configuration.
Also seeing this issue. Justin's workaround works for me. Developing on Intellij 2017.2 and targeting 2017.2 as well.
I am also facing this issue. I essentially have to run `mvn package` every time to generate a zip. Then first uninstall the old version, restart, add the generated zip to the plugins, restart and then it finally loads the updated code. That workflow seems quite developer unfriendly :( Would like to know how I can improve on this.
Sorry to awaken an old post, but I thought others might come across this, as I did today, and would appreciate another tip.
I found this exact behaviour (changes not picked up after the initial launch) and found that the simplest way to address this was to edit the `plugin.xml` in the `META-INF` directory and increment the `<version>` tag. Every time I changed the version, my changes would be picked up.