IDEA Plugin Dev Only Works In Debug Mode But Not Once Deployed
Hey,
Im starting to create a new plugin for a custom language.
I have followed the tutorial pages and when i hit build, it opens a new instance of IDEA where my plugin is working.
If I then prepare the plugin for deployment and load the .jar file into my own new instance of IDEA, the plugin loads but my new language is not available.
Any ideas why this may be?
I have the <idea-version since-build> set to the latest version
I also have the
<depends>com.intellij.modules.lang</depends>
exposed to allow the plugin to work in pycharm for instance.
No matter what I do it just does not work once its deployed
Any ideas or pointers?
Adam
Please sign in to leave a comment.
Hello,
why do you think that your plugin is loaded? Is it shown in File | Settings | Plugins with the proper version?
And how do you create 'jar' file of the plugin?
--
Nikolay Chashnikov
JetBrains
http://www.jetbrains.com
"Develop with pleasure!"
Hey Nikolay,
Thanks for getting back to me.
So here is a more depth explaination.
I have taken the simplePlugin example and have the source code from github loaded in Intellij Idea 14.
If I go to Build>Make Project the plugin compiles with no issues.
If I click on the Run>Run and select the standard 'Plugin' configuration this launches a new instance of Intellij Idea 14.
Where if I create a new file of .simple file type, it automatically gets detected and shows the little icon as expected.
All good so far and pretty straight forwards.
If I then do Build>Make Project
and then Build>Prepare Plugin Module 'Simple Plugin' For Deployment
this also completes and I end up with a SimplePlugin.jar file.
If I then close everything down and open a new instance of either Intellij Idea 14 or PyCharm4.5.
Go to the settings and install a plugin from local disk.
The simplePlugin then shows up in the list of plugins showing as loaded, when i hit apply the application asks for a restart.
I hit restart and the application (either Intellij 14 or Pycharm, both do the same)
reloads. If I go back to the plugin menu, the plugin is still showing as loaded and no issues.
However if I now create a file with extension .simple the application asks me to select which fileType to associate it with, the .simple file type is not available.
If i close this and in the settings look at which FileTypes are registered the .simple extension is not available.
If i close this and run in debug mode, it all works again without changing a single line of code.
So i have the situation, where in debug via the run configuration it all works, but when i deploy it and load the .jar file it loads with no erorrs but just does not work.
Im on Mac, latest os using the latest versions of both Idea and PyCharm if that helps
Cheers
Adam
Hmm, it's strange. Could you please check that the proper version of plugin.xml is packed to META-INF in SimplePlugin.jar?
--
Nikolay Chashnikov
JetBrains
http://www.jetbrains.com
"Develop with pleasure!"
Hey,
Yeah its strage all right, its driving me crazy! :)
This is the contents of the .jar file plugin.xml
<idea-plugin version="2">
<id>HERE</id>
<name>HERE</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>
<small>most HTML tags may be used</small>
]]></description>
<change-notes><![CDATA[
Add change notes here.<br>
<small>most HTML tags may be used</small>
]]>
</change-notes>
<!-- please see http://confluence.jetbrains.net/display/IDEADEV/Build+Number+Ranges for description -->
<idea-version since-build="145.0"/>
<!-- please see http://confluence.jetbrains.net/display/IDEADEV/Plugin+Compatibility+with+IntelliJ+Platform+Products
on how to target different products -->
<depends>com.intellij.modules.lang</depends>
<application-components>
<!-- Add your application components here -->
</application-components>
<project-components>
<!-- Add your project components here -->
</project-components>
<actions>
<!-- Add your actions here -->
</actions>
<extensions defaultExtensionNs="com.intellij">
<!-- Add your extensions here -->
<fileTypeFactory implementation="com.simpleplugin.SimpleFileTypeFactory"/>
<lang.parserDefinition language="Simple" implementationClass="com.simpleplugin.SimpleParserDefinition"/>
<lang.syntaxHighlighterFactory key="Simple" implementationClass="com.simpleplugin.SimpleSyntaxHighlighterFactory"/>
<colorSettingsPage implementation="com.simpleplugin.SimpleColorSettingsPage"/>
<annotator language="JAVA" implementationClass="com.simpleplugin.SimpleAnnotator"/>
<codeInsight.lineMarkerProvider language="JAVA" implementationClass="com.simpleplugin.SimpleLineMarkerProvider"/>
<completion.contributor language="Simple" implementationClass="com.simpleplugin.SimpleCompletionContributor"/>
<psi.referenceContributor implementation="com.simpleplugin.SimpleReferenceContributor"/>
<lang.findUsagesProvider language="Simple" implementationClass="com.simpleplugin.SimpleFindUsagesProvider"/>
<lang.refactoringSupport language="Simple" implementationClass="com.simpleplugin.SimpleRefactoringSupportProvider"/>
<lang.foldingBuilder language="JAVA" implementationClass="com.simpleplugin.SimpleFoldingBuilder"/>
<gotoSymbolContributor implementation="com.simpleplugin.SimpleChooseByNameContributor"/>
<lang.psiStructureViewFactory language="Simple" implementationClass="com.simpleplugin.SimpleStructureViewFactory"/>
<lang.formatter language="Simple" implementationClass="com.simpleplugin.SimpleFormattingModelBuilder"/>
<codeStyleSettingsProvider implementation="com.simpleplugin.SimpleCodeStyleSettingsProvider"/>
<langCodeStyleSettingsProvider implementation="com.simpleplugin.SimpleLanguageCodeStyleSettingsProvider"/>
<lang.commenter language="Simple" implementationClass="com.simpleplugin.SimpleCommenter"/>
</extensions>
</idea-plugin>
Please check that you don't have other copies of the plugin in idea.config.path/plugins directory.
Also you can try to debug the problem: run the IDE with debug parameter, connect to it from IDEA, put a breakpoint in
FileTypeManagerImpl#initStandardFileTypes method and check whether your implementation is returned from
FileTypeFactory.FILE_TYPE_FACTORY_EP.getExtensions() call. Also you can call PluginManagerCore.getPlugins() and find your plugin in the result to
check whether the plugin is actually loaded from the correct JAR file.
--
Nikolay Chashnikov
JetBrains
http://www.jetbrains.com
"Develop with pleasure!"
Hey,
I ensured that there were no older versions of the plugin loaded, or on any of the config paths.
Also tested this on a clean install on a new machine and It still does not work.
So I went back to stage one as I still cant get this working.
I decided to checkout the SimplePlugin
from https://github.com/JetBrains/SimplePlugin
Again, if I run the debug build from within idea everything seems to work
This compiles fine, and in Pycharm 4.5 when I load it I get the following error.
Any Ideas, as given that even the example code direct from git hub errors, im struggling here..
com/simpleplugin/SimpleReferenceContributor : Unsupported major.minor version 52.0 [Plugin: com.yourcompany.unique.plugin.id]
com.intellij.diagnostic.PluginException: com/simpleplugin/SimpleReferenceContributor : Unsupported major.minor version 52.0 [Plugin: com.yourcompany.unique.plugin.id]
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:247)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:249)
at com.intellij.openapi.extensions.AbstractExtensionPointBean.findClass(AbstractExtensionPointBean.java:42)
at com.intellij.openapi.extensions.AbstractExtensionPointBean.instantiate(AbstractExtensionPointBean.java:63)
at com.intellij.openapi.extensions.CustomLoadingExtensionPointBean.instantiateExtension(CustomLoadingExtensionPointBean.java:47)
at com.intellij.psi.impl.source.resolve.reference.PsiReferenceContributorEP.access$000(PsiReferenceContributorEP.java:30)
at com.intellij.psi.impl.source.resolve.reference.PsiReferenceContributorEP$1.compute(PsiReferenceContributorEP.java:43)
at com.intellij.psi.impl.source.resolve.reference.PsiReferenceContributorEP$1.compute(PsiReferenceContributorEP.java:38)
at com.intellij.openapi.util.NotNullLazyValue.getValue(NotNullLazyValue.java:39)
at com.intellij.psi.impl.source.resolve.reference.PsiReferenceContributorEP.getInstance(PsiReferenceContributorEP.java:54)
at com.intellij.psi.impl.source.resolve.reference.PsiReferenceContributorEP.getInstance(PsiReferenceContributorEP.java:30)
at com.intellij.openapi.util.KeyedExtensionCollector.buildExtensions(KeyedExtensionCollector.java:154)
at com.intellij.openapi.util.KeyedExtensionCollector.buildExtensions(KeyedExtensionCollector.java:127)
at com.intellij.openapi.util.KeyedExtensionCollector.forKey(KeyedExtensionCollector.java:115)
at com.intellij.lang.LanguageExtension.allForLanguage(LanguageExtension.java:71)
at com.intellij.psi.impl.source.resolve.reference.ReferenceProvidersRegistryImpl$2.create(ReferenceProvidersRegistryImpl.java:49)
at com.intellij.psi.impl.source.resolve.reference.ReferenceProvidersRegistryImpl$2.create(ReferenceProvidersRegistryImpl.java:45)
at com.intellij.util.containers.FactoryMap.get(FactoryMap.java:56)
at com.intellij.psi.impl.source.resolve.reference.ReferenceProvidersRegistryImpl.getRegistrar(ReferenceProvidersRegistryImpl.java:86)
at com.intellij.psi.impl.source.resolve.reference.ReferenceProvidersRegistryImpl.doGetReferencesFromProviders(ReferenceProvidersRegistryImpl.java:96)
at com.intellij.psi.impl.source.resolve.reference.ReferenceProvidersRegistry.getReferencesFromProviders(ReferenceProvidersRegistry.java:70)
at com.intellij.psi.impl.source.resolve.reference.ReferenceProvidersRegistry.getReferencesFromProviders(ReferenceProvidersRegistry.java:56)
at com.intellij.psi.impl.source.PsiPlainTextFileImpl.getReferences(PsiPlainTextFileImpl.java:52)
at org.intellij.plugins.intelliLang.references.InjectedReferencesContributor.getInjectedReferences(InjectedReferencesContributor.java:55)
at org.intellij.plugins.intelliLang.references.InjectedReferencesInspection$1.visitElement(InjectedReferencesInspection.java:38)
at com.intellij.psi.PsiElementVisitor.visitFile(PsiElementVisitor.java:34)
at com.intellij.psi.PsiElementVisitor.visitPlainTextFile(PsiElementVisitor.java:42)
at com.intellij.psi.impl.source.PsiPlainTextFileImpl.accept(PsiPlainTextFileImpl.java:36)
at com.intellij.codeInspection.InspectionEngine.acceptElements(InspectionEngine.java:80)
at com.intellij.codeInspection.InspectionEngine.createVisitorAndAcceptElements(InspectionEngine.java:69)
at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass.a(LocalInspectionsPass.java:285)
at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass.access$200(LocalInspectionsPass.java:75)
at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass$2.process(LocalInspectionsPass.java:254)
at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass$2.process(LocalInspectionsPass.java:251)
at com.intellij.concurrency.ApplierCompleter.a(ApplierCompleter.java:122)
at com.intellij.concurrency.ApplierCompleter.access$000(ApplierCompleter.java:44)
at com.intellij.concurrency.ApplierCompleter$1.run(ApplierCompleter.java:85)
at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1098)
at com.intellij.concurrency.ApplierCompleter$2.run(ApplierCompleter.java:94)
at com.intellij.openapi.progress.impl.CoreProgressManager.a(CoreProgressManager.java:452)
at com.intellij.openapi.progress.impl.CoreProgressManager.a(CoreProgressManager.java:449)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:402)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:54)
at com.intellij.concurrency.ApplierCompleter.a(ApplierCompleter.java:106)
at com.intellij.concurrency.ApplierCompleter.compute(ApplierCompleter.java:82)
at jsr166e.CountedCompleter.exec(CountedCompleter.java:684)
at jsr166e.ForkJoinTask.doExec(ForkJoinTask.java:260)
at jsr166e.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:858)
at jsr166e.ForkJoinPool.scan(ForkJoinPool.java:1687)
at jsr166e.ForkJoinPool.runWorker(ForkJoinPool.java:1642)
at jsr166e.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:109)
Caused by: java.lang.UnsupportedClassVersionError: com/simpleplugin/SimpleReferenceContributor : Unsupported major.minor version 52.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:637)
at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
at java.lang.ClassLoader.defineClass(ClassLoader.java:471)
at com.intellij.util.lang.UrlClassLoader._defineClass(UrlClassLoader.java:259)
at com.intellij.util.lang.UrlClassLoader.defineClass(UrlClassLoader.java:255)
at com.intellij.util.lang.UrlClassLoader._findClass(UrlClassLoader.java:231)
at com.intellij.ide.plugins.cl.PluginClassLoader.b(PluginClassLoader.java:124)
... 54 more
Would it matter if I am using jdk 1.8 instead of 1.6??
I would asume that as long as when you run the debug configuration and everything works (as it does). All should be fine when you deploy?
Hello,
this exception means that you compiled the plugin using JDK 1.8 but run it under JDK 1.6. To fix the problem you should either compile the plugin
using JDK 1.6 or run PyCharm under JDK 1.8
(https://intellij-support.jetbrains.com/hc/en-us/articles/206827547-Selecting-the-JDK-version-the-IDE-will-run-under).
--
Nikolay Chashnikov
JetBrains
http://www.jetbrains.com
"Develop with pleasure!"
Hey,
So im up and running thanks for the help!
Im at step 4 in the tutorial
"Now we can generate a lexer class via JFlex Generator from the context menu or via⌘⇧G shortcut on Simple.flex file."
But during the download of the lexer skeleton framework the download dialogu is erroring
Failed to download 'https://raw.github.com/JetBrains/intellij-community/master/tools/lexer/idea-flex.skeleton': Cannot download 'https://raw.githubusercontent.com/JetBrains/intellij-community/master/tools/lexer/idea-flex.skeleton': Server returned HTTP response code: 503 for URL: https://raw.githubusercontent.com/JetBrains/intellij-community/master/tools/lexer/idea-flex.skeleton
, response: 503 backend read error