getgauge/Intellij-Plugin

Unsupported Gauge Version: This version of Gauge Intellij plugin only works with Gauge version >= 0.9.0

dejj opened this issue · 10 comments

dejj commented

This seems to be a recurring issue, see:

I'm having the same issue on Linux Mint 19.1
Gauge version: 1.0.7,
Commit Hash: ed7b4fd6,
java (0.7.4)

on IntelliJ IDEA Ultimate 2019.3
Gauge plugin 0.3.18

Things I've tried:

  • gauge telemetry off -> This command is deprecated, since Gauge no longer collects telemetry.
  • Confirmed that IntelliJ plugin has paths set. Gauge binary path is /usr/local/bin/gauge (as per which gauge). GAUGE_HOME is ~/.gauge
sriv commented

Tried on 19.1 (ubuntu derivative) with Intellij IDEA 2019.3.4 (that's the latest presently) and I could create a gauge-java project, run a spec, navigate successfully.

If gauge is available in PATH, could you clear the gauge binary path in IDEA and try?

The format of the error is Unsupported Gauge Version(%s): and that should have printed the version the plugin resolved, so it's a bit weird that it printed an empty(null) string in your machine.

dejj commented

I removed the binary path and tried to create a project. The actual popup error message is:
Error adding module to project: This version of Gauge Intellij plugin only works with Gauge version >= 0.9.0

I noticed that the plugin writes log messages. And here it is:
Unable to parse </usr/local/bin/gauge --version --machine-readable> command's output.: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $

The output of /usr/local/bin/gauge --version --machine-readable is:

{
    "version": "1.0.7",
    "commitHash": "ed7b4fd6",
    "plugins": [
        {
            "name": "java",
            "version": "0.7.4"
        }
    ]
}

Maybe GaugeUtil.getOutput puts extra double-quotes around the output, which confuses the Gson parser.
I'd now very much like to start the debugger on GaugeVersion.java of the plugin, but I don't know how.

sriv commented

I added a log entry for printing the output (result of GaugeUtil.getOutput). Please install the plugin attached and check the logs again.
Gauge-Java-Intellij-0.3.19.zip

sriv commented

Note that you can install the plugin from Intellij using the local install option.

And on debugging the intellij-plugin - you'll have to do some setup (https://github.com/getgauge/Intellij-Plugin/blob/master/devguide.md). Post which, you can edit code, and launch Intellij IDEA in debug mode, allowing you to set breakpoints.

dejj commented

I unpacked the archived and manually installed intellij-plugin-0.3.19.jar.
Event log still reads:
Unable to parse </usr/local/bin/gauge --version --machine-readable> command's output.: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $

stacktrace.txt reads as below.
Folder ~/.gauge/plugins exists and has mode 755.

java.lang.Throwable: Unable to parse </usr/local/bin/gauge --version --machine-readable> command's output.
error: open ~/.gauge/plugins: no such file or directory
{
    "version": "1.0.7",
    "commitHash": "ed7b4fd6",
    "plugins": []
}


	at com.intellij.openapi.diagnostic.Logger.error(Logger.java:145)
	at com.thoughtworks.gauge.core.GaugeVersion.getVersion(GaugeVersion.java:56)
	at com.thoughtworks.gauge.core.GaugeVersion.<clinit>(GaugeVersion.java:37)
	at com.thoughtworks.gauge.module.GaugeModuleBuilder.checkGaugeIsInstalled(GaugeModuleBuilder.java:63)
	at com.thoughtworks.gauge.module.GaugeModuleBuilder.setupRootModel(GaugeModuleBuilder.java:54)
	at com.intellij.ide.util.projectWizard.ModuleBuilder.setupModule(ModuleBuilder.java:257)
	at com.intellij.ide.util.projectWizard.ModuleBuilder.createModule(ModuleBuilder.java:250)
	at com.intellij.ide.util.projectWizard.ModuleBuilder.createAndCommitIfNeeded(ModuleBuilder.java:289)
	at com.intellij.ide.util.projectWizard.ModuleBuilder.lambda$commitModule$3(ModuleBuilder.java:332)
	at com.intellij.openapi.application.impl.ApplicationImpl.runWriteActionWithClass(ApplicationImpl.java:873)
	at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:899)
	at com.intellij.ide.util.projectWizard.ModuleBuilder.commitModule(ModuleBuilder.java:331)
	at com.intellij.ide.util.projectWizard.ModuleBuilder.commit(ModuleBuilder.java:317)
	at com.intellij.ide.util.projectWizard.JavaModuleBuilder.commit(JavaModuleBuilder.java:170)
	at com.intellij.ide.impl.NewProjectUtil.doCreate(NewProjectUtil.java:160)
	at com.intellij.ide.impl.NewProjectUtil.createFromWizard(NewProjectUtil.java:76)
	at com.intellij.ide.impl.NewProjectUtil.createFromWizard(NewProjectUtil.java:71)
	at com.intellij.ide.impl.NewProjectUtil.createNewProject(NewProjectUtil.java:66)
	at com.intellij.ide.actions.NewProjectAction.actionPerformed(NewProjectAction.java:27)
	at com.intellij.openapi.actionSystem.ex.ActionUtil$1.run(ActionUtil.java:298)
	at com.intellij.openapi.application.TransactionGuardImpl.runSyncTransaction(TransactionGuardImpl.java:83)
	at com.intellij.openapi.application.TransactionGuardImpl.submitTransactionAndWait(TransactionGuardImpl.java:149)
	at com.intellij.openapi.actionSystem.ex.ActionUtil.performActionDumbAware(ActionUtil.java:313)
	at com.intellij.openapi.actionSystem.impl.ActionMenuItem$ActionTransmitter.lambda$actionPerformed$0(ActionMenuItem.java:294)
	at com.intellij.openapi.wm.impl.FocusManagerImpl.runOnOwnContext(FocusManagerImpl.java:263)
	at com.intellij.openapi.wm.impl.IdeFocusManagerImpl.runOnOwnContext(IdeFocusManagerImpl.java:77)
	at com.intellij.openapi.actionSystem.impl.ActionMenuItem$ActionTransmitter.actionPerformed(ActionMenuItem.java:284)
	at java.desktop/javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1967)
	at com.intellij.openapi.actionSystem.impl.ActionMenuItem.lambda$fireActionPerformed$0(ActionMenuItem.java:112)
	at com.intellij.openapi.application.TransactionGuardImpl.runSyncTransaction(TransactionGuardImpl.java:83)
	at com.intellij.openapi.application.TransactionGuardImpl.lambda$submitTransaction$1(TransactionGuardImpl.java:107)
	at com.intellij.openapi.application.TransactionGuardImpl.submitTransaction(TransactionGuardImpl.java:116)
	at com.intellij.openapi.application.TransactionGuard.submitTransaction(TransactionGuard.java:121)
	at com.intellij.openapi.actionSystem.impl.ActionMenuItem.fireActionPerformed(ActionMenuItem.java:112)
	at com.intellij.ui.plaf.beg.BegMenuItemUI.doClick(BegMenuItemUI.java:517)
	at com.intellij.ui.plaf.beg.BegMenuItemUI.access$300(BegMenuItemUI.java:36)
	at com.intellij.ui.plaf.beg.BegMenuItemUI$MyMouseInputHandler.mouseReleased(BegMenuItemUI.java:539)
	at java.desktop/java.awt.Component.processMouseEvent(Component.java:6651)
	at java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3342)
	at java.desktop/java.awt.Component.processEvent(Component.java:6416)
	at java.desktop/java.awt.Container.processEvent(Container.java:2263)
	at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:5026)
	at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2321)
	at java.desktop/java.awt.Component.dispatchEvent(Component.java:4858)
	at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4918)
	at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4547)
	at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4488)
	at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2307)
	at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2773)
	at java.desktop/java.awt.Component.dispatchEvent(Component.java:4858)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:778)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:727)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:95)
	at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:751)
	at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:749)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
	at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:748)
	at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:908)
	at com.intellij.ide.IdeEventQueue.dispatchMouseEvent(IdeEventQueue.java:846)
	at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:778)
	at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$8(IdeEventQueue.java:424)
	at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:698)
	at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:423)
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)

I then set GAUGE_HOME to the absolute path, restarted the IDE an received the below.
I verified that the plugin version 0.3.19 is still installed and activated.

java.lang.NoClassDefFoundError: com/thoughtworks/gauge/PluginNotInstalledException
	at com.thoughtworks.gauge.module.GaugeModuleBuilder.setupRootModel(GaugeModuleBuilder.java:57)
	at com.intellij.ide.util.projectWizard.ModuleBuilder.setupModule(ModuleBuilder.java:257)
	at com.intellij.ide.util.projectWizard.ModuleBuilder.createModule(ModuleBuilder.java:250)
	at com.intellij.ide.util.projectWizard.ModuleBuilder.createAndCommitIfNeeded(ModuleBuilder.java:289)
	at com.intellij.ide.util.projectWizard.ModuleBuilder.lambda$commitModule$3(ModuleBuilder.java:332)
	at com.intellij.openapi.application.impl.ApplicationImpl.runWriteActionWithClass(ApplicationImpl.java:873)
	at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:899)
	at com.intellij.ide.util.projectWizard.ModuleBuilder.commitModule(ModuleBuilder.java:331)
	at com.intellij.ide.util.projectWizard.ModuleBuilder.commit(ModuleBuilder.java:317)
	at com.intellij.ide.util.projectWizard.JavaModuleBuilder.commit(JavaModuleBuilder.java:170)
	at com.intellij.ide.impl.NewProjectUtil.doCreate(NewProjectUtil.java:160)
	at com.intellij.ide.impl.NewProjectUtil.createFromWizard(NewProjectUtil.java:76)
	at com.intellij.ide.impl.NewProjectUtil.createFromWizard(NewProjectUtil.java:71)
	at com.intellij.ide.impl.NewProjectUtil.createNewProject(NewProjectUtil.java:66)
	at com.intellij.ide.actions.NewProjectAction.actionPerformed(NewProjectAction.java:27)
	at com.intellij.openapi.actionSystem.ex.ActionUtil$1.run(ActionUtil.java:298)
	at com.intellij.openapi.application.TransactionGuardImpl.runSyncTransaction(TransactionGuardImpl.java:83)
	at com.intellij.openapi.application.TransactionGuardImpl.submitTransactionAndWait(TransactionGuardImpl.java:149)
	at com.intellij.openapi.actionSystem.ex.ActionUtil.performActionDumbAware(ActionUtil.java:313)
	at com.intellij.openapi.actionSystem.impl.ActionMenuItem$ActionTransmitter.lambda$actionPerformed$0(ActionMenuItem.java:294)
	at com.intellij.openapi.wm.impl.FocusManagerImpl.runOnOwnContext(FocusManagerImpl.java:263)
	at com.intellij.openapi.wm.impl.IdeFocusManagerImpl.runOnOwnContext(IdeFocusManagerImpl.java:77)
	at com.intellij.openapi.actionSystem.impl.ActionMenuItem$ActionTransmitter.actionPerformed(ActionMenuItem.java:284)
	at java.desktop/javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1967)
	at com.intellij.openapi.actionSystem.impl.ActionMenuItem.lambda$fireActionPerformed$0(ActionMenuItem.java:112)
	at com.intellij.openapi.application.TransactionGuardImpl.runSyncTransaction(TransactionGuardImpl.java:83)
	at com.intellij.openapi.application.TransactionGuardImpl.lambda$submitTransaction$1(TransactionGuardImpl.java:107)
	at com.intellij.openapi.application.TransactionGuardImpl.submitTransaction(TransactionGuardImpl.java:116)
	at com.intellij.openapi.application.TransactionGuard.submitTransaction(TransactionGuard.java:121)
	at com.intellij.openapi.actionSystem.impl.ActionMenuItem.fireActionPerformed(ActionMenuItem.java:112)
	at com.intellij.ui.plaf.beg.BegMenuItemUI.doClick(BegMenuItemUI.java:517)
	at com.intellij.ui.plaf.beg.BegMenuItemUI.access$300(BegMenuItemUI.java:36)
	at com.intellij.ui.plaf.beg.BegMenuItemUI$MyMouseInputHandler.mouseReleased(BegMenuItemUI.java:539)
	at java.desktop/java.awt.Component.processMouseEvent(Component.java:6651)
	at java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3342)
	at java.desktop/java.awt.Component.processEvent(Component.java:6416)
	at java.desktop/java.awt.Container.processEvent(Container.java:2263)
	at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:5026)
	at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2321)
	at java.desktop/java.awt.Component.dispatchEvent(Component.java:4858)
	at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4918)
	at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4547)
	at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4488)
	at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2307)
	at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2773)
	at java.desktop/java.awt.Component.dispatchEvent(Component.java:4858)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:778)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:727)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:95)
	at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:751)
	at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:749)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
	at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:748)
	at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:908)
	at com.intellij.ide.IdeEventQueue.dispatchMouseEvent(IdeEventQueue.java:846)
	at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:778)
	at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$8(IdeEventQueue.java:424)
	at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:698)
	at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:423)
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
Caused by: java.lang.ClassNotFoundException: com.thoughtworks.gauge.PluginNotInstalledException PluginClassLoader[com.thoughtworks.gauge, 0.3.19] com.intellij.ide.plugins.cl.PluginClassLoader@306d0653
	at com.intellij.ide.plugins.cl.PluginClassLoader.loadClass(PluginClassLoader.java:77)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
	... 69 more
sriv commented

error: open ~/.gauge/plugins: no such file or directory is the culprit for the deserialization fail. But this is one part of the issue.

Since you mentioned /usr/local/bin/gauge --version --machine-readable yields the expected result, without the error, I suspect that perhaps your Intellij IDEA is running as a different user.

Note that ~/ resolves to the home directory of the user. So if running as a different user, this probably not exist.

sriv commented

I just realized the last point. Tried this:

$ sudo su
root@<--->:/home/<---># gauge -v --machine-readable
error: open /root/.gauge/plugins: no such file or directory
{
    "version": "1.0.8",
    "commitHash": "28617ea",
    "plugins": []
}
dejj commented

Yes. I built the plugin myself and got the same JSON structure with an empty plugins list.

To test if the process ran as a different user, I replaced GaugeUtil.setGaugeEnvironmentsTo(processBuilder, settings); with processBuilder.command("id");

The Event Log then read:

uid=1000(dejj) gid=1000(dejj) Gruppen=1000(dejj),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),112(lpadmin),127(sambashare),128(docker),999(vboxsf)

Seems normal.

Then I noticed that something had created a folder at ~/'~'/.gauge. I removed the folder, and set my GAUGE_PATH to an absolute one again. Now I'm again getting PluginNotInstalledException.

sriv commented

What happens if you set GAUGE_HOME manually to a global path (ex. /tmp/gauge_home) ? In Intellij IDEA, you can do this using the 'Gauge' Settings. On CLI, this is an env var.

As for troubleshooting PluginNotInstalledException, could you please check api.log in your Project? Mine has entries like:

25-03-2020 08:22:33.740 [Gauge] [INFO] Gauge daemon initialized and listening on port: 34629
25-03-2020 08:22:38.801 [Gauge] [DEBUG] Api Request Received: messageType:GetLanguagePluginLibPathRequest messageId:5 libPathRequest:<language:"java" > 
25-03-2020 08:22:38.802 [Gauge] [DEBUG] Sending API response: messageType:GetLanguagePluginLibPathResponse messageId:5 libPathResponse:<path:"/home/*****/.gauge/plugins/java/0.7.4/libs" > 
zabil commented

Closing this as there seems be no activity.
Please feel free to re-open if it's still happening.