EN
Intellij - fix for Error running unit tests. Command line is too long. Shorten the command line via JAR manifest or via a classpath file and rerun.
3
points
Problem
I downloaded some project from github, imported it using maven and got an error when I tried run unit test.
Error message:
Error running UserRepositoryTest.someTest. Command line is too long.
Shorten the command line via JAR manifest or via a classpath file and rerun.
Error screenshot:
Solution
To solve the problem we need to change Shorten command line
option to JAR manifest - java-cp classpath.jar className [args]
, the default one is: none - java [options] className [args]
.
Steps:
- Edit configuration of the test.
- Click on '
Modify options
' and select 'Shorten command line
'. - Select
JAR manifest - java-cp classpath.jar className [args]
from Shorten command line options. - Run the test again with success.
The same solution with screenshot steps.
Step 1
Edit configuration of the test.
Step 2
Click on 'Modify options' and select 'Shorten command line'.
Step 3
Select JAR manifest - java-cp classpath.jar className [args] from Shorten command line options.
Step 4
Run the test again with success.