IntelliJ: Command Line is too Long. Shorten command line for... in SBT project

This answer is based on IntelliJ 2020.1.4

  1. Open the configuration. This is usually found in the Debug/Run toolbar.
  2. You will find Shorten Command Line item in the Configuration dialog box. There are different modes that you can select there. In my case JAR Manifiest worked.

You can also set this as the default the next time you auto-generate a test.

enter image description here


Found the fix, this is SBT specific. I believe what is happening is that the libaryDependencies one puts in their build.sbt file actually adds all the jars of those dependencies to the classpath used to run your program.

To fix this, simply add

lazy val scriptClasspath = Seq("*") (the lazy may be optional)

to your build.sbt file. I placed mine above the root val with the library dependencies. Not sure if that's necessary, but shift it around if you're having trouble

What this does, is upon running the program SBT will condense the "long" classpath built by those jars into a jar of its own, and just run that jar, which will kick off all of your dependencies and program.

Check this out for the longer demonstration, as well as other answers