Search code examples
javaintellij-ideaintellij-pluginintellij-14

Programmatically get the version of an IntelliJ IDEA plugin


Is there a way to programmatically get the version of an IntelliJ IDEA plugin?

I'm creating my own IntelliJ IDEA plugin, and I have set the version property in the plugin.xml(e.g.:<version>3.1.1</version>). I need to get the version to display in the "About" dialog of my plugin. Is there a way to get this value programmatically?

I'm new to IntelliJ IDEA plugin development, if there is a different way to display a version number please let me know.


Solution

  • Here you go mate:

    PluginManager.getPlugin(PluginId.getId("my.plugin.id")).getVersion();
    

    Edit: from 2020, use

    PluginManagerCore.getPlugin