PhpStorm plugin isn't able to be created/unsupported major.minor version

I'm not sure if this message should be in the Plugin Development forum, or the in PhpStorm forum, so I'll post here first.

I'm in the process of getting up to speed writing a plugin for PhpStorm.  I've created a (simple) plugin for IntelliJ, and now I'm creating a new (equally simple) plugin for PhpStorm.  The plugin action is to be added to the Tools menu, and when clicked, display a dialog box.  I've been ablle to create the action and display the dialog box with the first plugin I created (for intelliJ), but I'm running into some issues now with a new plugin for PhpStorm.

To create the PhpStorm plugin, I followed the same steps I took to create the plugin for IntelliJ...

I selected File > New > Project > IntelliJ Platform Plugin

I then created a new package called com.yourcompany.Sample6Id

I then created a new Action...
Action ID: com.yourcompany.Sample6Id
Class name: Sample6
Group:ToolsMenu
Anchor:First

I then added code to Sample6's actionPerformed() to display a dialog box

I built & compiled plugin #2 (Sample6) & debugged it against IntelliJ just to make sure it ran.  So far so good.

I then followed the steps posted at https://confluence.jetbrains.com/display/PhpStorm/Setting-up+environment+for+PhpStorm+plugin+development to setup the plugin to be able to run in PhpStorm.  Specifically, I...
1) Added php-openapi.jar and php.jar to the libraries
2) In Dependencies I changed the scope of php-openapi to provided
3) Added <depends>com.jetbrains.php</depends> and <depends>com.intellij.modules.platform</depends> to plugin.xml


I then rebuilt the project, then selected Build > Prepare Plugin Modlue 'Sample6'  For Deployment

I then ran PhpStorm, then selected File> Settings > Plugins > Install Plugin From Disk, browsed to Sample6.jar and selected it, then restarted PhpStorm.

PhpStorm started up w/o any errors, but when I clicked the Tools menu, "Sample6" wasn't present, and en error appeared in the event log:

PluginException: cannot create class "com.yourcompany.Sample6Id.Sample6" [Plugin: com.yourcompany.Sample6Id]


The deatils of the error are:
cannot create class "com.yourcompany.Sample6Id.Sample6" [Plugin: com.yourcompany.Sample6Id]
com.intellij.diagnostic.PluginException: cannot create class "com.yourcompany.Sample6Id.Sample6" [Plugin: com.yourcompany.Sample6Id]
 at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.convertStub(ActionManagerImpl.java:175)
 at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.a(ActionManagerImpl.java:531)
 at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.a(ActionManagerImpl.java:511)
 at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.getAction(ActionManagerImpl.java:488)
 at com.intellij.openapi.actionSystem.DefaultActionGroup.unStub(DefaultActionGroup.java:354)
 at com.intellij.openapi.actionSystem.DefaultActionGroup.getChildren(DefaultActionGroup.java:312)
 at com.intellij.openapi.actionSystem.impl.ActionManagerImpl$5.compute(ActionManagerImpl.java:1324)
 at com.intellij.openapi.actionSystem.impl.ActionManagerImpl$5.compute(ActionManagerImpl.java:1317)
 at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:931)
 at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.a(ActionManagerImpl.java:1317)
 at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.a(ActionManagerImpl.java:1332)
 at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.preloadActionGroup(ActionManagerImpl.java:1311)
 at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.c(ActionManagerImpl.java:1302)
 at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.access$200(ActionManagerImpl.java:75)
 at com.intellij.openapi.actionSystem.impl.ActionManagerImpl$4.run(ActionManagerImpl.java:1282)
 at com.intellij.openapi.application.impl.ApplicationImpl$8.run(ApplicationImpl.java:406)
 at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
 at java.util.concurrent.FutureTask.run(FutureTask.java:262)
 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
 at java.lang.Thread.run(Thread.java:745)
 at org.jetbrains.ide.PooledThreadExecutor$1$1.run(PooledThreadExecutor.java:56)
Caused by: com.intellij.diagnostic.PluginException: com/yourcompany/Sample6Id/Sample6 : Unsupported major.minor version 52.0 [Plugin: com.yourcompany.Sample6Id]
 at com.intellij.ide.plugins.cl.PluginClassLoader.b(PluginClassLoader.java:130)
 at com.intellij.ide.plugins.cl.PluginClassLoader.a(PluginClassLoader.java:77)
 at com.intellij.ide.plugins.cl.PluginClassLoader.loadClass(PluginClassLoader.java:66)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
 at java.lang.Class.forName0(Native Method)
 at java.lang.Class.forName(Class.java:270)
 at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.convertStub(ActionManagerImpl.java:151)
 ... 21 more
Caused by: java.lang.UnsupportedClassVersionError: com/yourcompany/Sample6Id/Sample6 : Unsupported major.minor version 52.0
 at java.lang.ClassLoader.defineClass1(Native Method)
 at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
 at java.lang.ClassLoader.defineClass(ClassLoader.java:643)
 at com.intellij.util.lang.UrlClassLoader._defineClass(UrlClassLoader.java:213)
 at com.intellij.util.lang.UrlClassLoader.defineClass(UrlClassLoader.java:209)
 at com.intellij.util.lang.UrlClassLoader._findClass(UrlClassLoader.java:185)
 at com.intellij.ide.plugins.cl.PluginClassLoader.b(PluginClassLoader.java:124)
 ... 27 more



From the error logged, it sounds like there's a version mis-match.  I'm not sure where "52" is coming from... the "version" in my plugin.xml is 1.0.  For reference, here is the entire plugin.xml that I have:

 
<idea-plugin version="2">
  <id>com.yourcompany.Sample6Id</id>
  <name>Sample6</name>
  <version>1.0</version>
  <vendor email="support@yourcompany.com" url="http://www.yourcompany.com">YourCompany</vendor>

  <description><![CDATA[
      Enter short description for your plugin here.<br>
      <em>most HTML tags may be used</em>
    ]]></description>

  <change-notes><![CDATA[
      Add change notes here.<br>
      <em>most HTML tags may be used</em>
    ]]>
  </change-notes>

  <!-- please see https://confluence.jetbrains.com/display/IDEADEV/Build+Number+Ranges for description -->
  <idea-version since-build="131"/>


  <!-- please see https://confluence.jetbrains.com/display/IDEADEV/Plugin+Compatibility+with+IntelliJ+Platform+Products
       on how to target different products -->
  <!-- uncomment to enable plugin in all products
  <depends>com.intellij.modules.lang</depends>
  -->
  <depends>
com.jetbrains.php</depends>
  <depends>com.intellij.modules.platform</depends>

  <extensions defaultExtensionNs="com.intellij">
    <!-- Add your extensions here -->
  </extensions>


  <application-components>
    <!-- Add your application components here -->
  </application-components>


  <project-components>
    <!-- Add your project components here -->
  </project-components>


  <actions>
    <!-- Add your actions here -->
    <action id="Sample6Id" class="com.yourcompany.Sample6Id.Sample6" text="Sample6..."
            description="Sample6 description">

      <add-to-group group-id="ToolsMenu" anchor="first"/>
    </action>
  </actions>

</idea-plugin>



The only reference I've found on PhpStorm development is at https://confluence.jetbrains.com/display/PhpStorm/Setting-up+environment+for+PhpStorm+plugin+development and from what I can tell I've set up my project correctly.


The plugin I created so far is pretty simple, so if needed I can post the code, but hopefully that won't be needed.


Any suggestions as to what to do?

Thanks,

Jeff

2 comments
Comment actions Permalink

You need to use JDK 6 as the base JDK for your IntelliJ IDEA plugin SDK.


0
Comment actions Permalink

Thanks!  I've got it working now.

Jeff

0

Please sign in to leave a comment.