14

I've encountered an issue running Cucumber tests in IntelliJ. When I try to run a feature or scenario, I get the following error:

"Error running 'Feature <feature>': Command line is too long. Shorten command line for Feature: <feature> or also for Cucumber java default configuration"

I know as part of IntelliJ's 2017.3 release, they added support for a "Shorten Command Line" option in the Run/Debug Configurations. However, if I compare the default configs, I don't see it as part of the Cucumber Java configuration, but I do see it in the JUnit configuration for example.

I don't get the popup tip that others have mentioned about the dynamic .classpath, I'm assuming because of this new release. Any ideas?

DFW
  • 805
  • 1
  • 8
  • 18
  • 1
    Does this answer your question? [How to configure "Shorten command line" method for whole project in IntelliJ](https://stackoverflow.com/questions/47926382/how-to-configure-shorten-command-line-method-for-whole-project-in-intellij) – Maulzey Dec 17 '19 at 17:56
  • I don't think it's applicable anymore, but that version of IntelliJ with the Cucumber for Java plugin didn't have that option available at the time. So no, not really. – DFW Feb 11 '20 at 03:30

3 Answers3

43

If you edit IntelliJ's workspace.xml file to set the dynamic.classpath property to true, it will work.

<component name="PropertiesComponent">
    ...
    <property name="dynamic.classpath" value="true" />
</component>

I believe IntelliJ used to do this via a popup for you, but since the "Shorten Command Line" feature in 2017.3 has been added to the normal default Run/Debug configurations, it no longer does it this way. And since Cucumber for Java is a plugin, it must not know what to do in that scenario.

Hopefully the issue is fixed to add the dropdown: Shorten command line dropdown

Found some of the answer here: IDEA 10.5 Command line is too long

DFW
  • 805
  • 1
  • 8
  • 18
7

Edit run configuration

Select JAR manifest in shorten command line

Select installed JRE not intelij SDK

Run now and it will work.

Nirbhay Rana
  • 4,229
  • 2
  • 18
  • 4
  • The point of the question is that the "Shorten command line" option does not exist for the Cucumber plugin. In the screen shot for the accepted answer, it points out what exists for the default JUnit configuration – DFW Sep 17 '18 at 15:23
0

There is no such option for Cucumber tests, here the issue to vote and follow: IDEA-184133.

Edit: issue was fixed in 2018.2 IDE version.

Andrey
  • 15,144
  • 25
  • 91
  • 187
  • OK, thanks for the issue. There has to be some sort of workaround though. I know others are able to run those same tests with the same version of IntelliJ and we can't figure out what's different between our setups. – DFW Jan 05 '18 at 13:50
  • Are you able to provide more information on what you are running and how? – Marit Jan 05 '18 at 15:08
  • I was running Cucumber feature files that worked for the rest of my team. Tried running them by right clicking on them and selecting Run or Debug . I think I've solved the problem now, tho it's probably only for people that have just downloaded IntelliJ recently. – DFW Jan 05 '18 at 15:35