Developing for multiple intellij versions

Hi all, I've been developing a plugin for intellij 13.1, some beta testers of mine are running intellij 12 and I need to address some compatablity issues. How can I develop for both and easily switch back and forth between the two? maybe in a run configuration?

12 comments
Comment actions Permalink

Your Project SDK defines what version of IntelliJ (or whatever IDE) will run when you use the plugin run configuration.

Define another SDK for your install of IntelliJ12 and just switch your project between SDK's

0
Comment actions Permalink

I'd suggest to branch your code for each major version and have separate projects with corresponding IntelliJ Platform SDK.


0
Comment actions Permalink

That is in fact what I do.

0
Comment actions Permalink

I do this as well, then I distribute them using an enterprise repo.

One question I have - to release versions of my plugin that support multiple IntelliJ versions in the JetBrains plugin repository, I guess I would need to have 3 different plugins - is that right? So I'd have "Cursive for IntelliJ 12", "Cursive for IntelliJ 13" and so forth. Is there any way around that?

0
Comment actions Permalink

AFAIU you could "limit" visibility of each plugin<->platform version by specifying corresponding min/max in its plugin.xml descriptor.

0
Comment actions Permalink

Look at my plugin http://plugins.jetbrains.com/plugin/7125

 
 
<idea-version since-build="128.55" until-build="134.000" /> 
 
0
Comment actions Permalink

So in that case, you can have basically the same version of your plugin targeting different versions of idea? Nice, I knew about the plugin XML ranges but I hadn't considered that. I'll give this a go, thanks.

0
Comment actions Permalink

So is it the case that there's no way for my plugin to tell at runtime what intellij version it's running in? So I can't release a single plugin that's compatible with both 12 and 13, I'd have to "rewrite" the plugin for version 12?

0
Comment actions Permalink

You can use com.intellij.openapi.application.ApplicationInfo#getMajorVersion to query runtime version information.
Of course, you could release the same plugin binary for several major versions, given there are no incompatibilities.

0
Comment actions Permalink

Right, the problem is that the APIs tend to change between versions. Depending on what your plugin does, you might be ok - those APIs might be stable and you might not have a problem. But as your plugin gets more sophisticated, it's more likely you'll hit an API you need to change. When that happens, you're best to have a branch for each IntelliJ version you support, and fix the API differences when you merge from one to the other. For example, I support v12, v13 and v13.1. I do my main development with v13.1, and fix the differences when I merge back before a release.

0
Comment actions Permalink

Agree, but small things can be handled with reflection.

0

Please sign in to leave a comment.