Unable to Run Certain Unit Tests 关注
I'm running into an issue where I try and run certain unit tests but get a failure as such below. Are there any solutions to fix this? I can run the test command line and attach a debugger but I think we should be able to run these within the IDE.
Command line is too long. Shorten command line for <fileName> or also for JUnit default configuration
If your command line is too long (OS is unable to create a process from command line of such length), IDEA provides you means to shorten the command line. The balloon should contain a link where you can switch between `none`|`classpath file`|`JAR-Manifest`|`args file (only available for jdk 9)`. If you run with any option but `none`, the command line would be shortened and OS should be able to start the process.
Do you still have a balloon when use one of the suggested (except `none`, please) options? If so, please enable debug option #com.intellij.execution.runners.ExecutionUtil (Help | Debug Log Settings), repeat running tests and attach idea.log (Help | Show log)
I have the very same issue in a completely different context. I am running a Spring Boot application. There is no other information, just the bubble with message:
And none of the four options helps.
1. user-local default: none --> no output, shows only the bubble
2. none --> no output, shows only the bubble
3. JAR manifest --> output is
4. classpath file --> output is
I'm using 2017.3.4 and I am running it with a JUnit Run/Debug Configuration. I have tried all the dropdowns in the Shorten Command Line option (user-local default: none, none, JAR Manifest, and classpath file) and have not been able to run them. I have listed the errors I receive from the application when doing so.
I have looked into the dynamic classpath flag and was able to change my workspace.xml file and with the settings below I got the same behavior.
When changing the flag to true and restarting, the IDE changed the Run/Debug Configuration and still error-ed out:
Any other thoughts here?
I have hit the same fail for a junit test that loads a json file from the classpath. (windows 10, IJ 2017.3.4)
initially long classpath prevented test running, switching to classpath strategy allows test to run, but Test fails as can't find the test resource on classpath :(
Have downgraded to 2017.2 to evade problem.
The original issue spawned from using the user-local default: none value for the shorten command line. The classpath file option behaves like the JAR Manifest from my observations.
There is no output, just a balloon popup with the message with the user-local default.
Sorry for the confusion
What is the IDE version you use? Do you run it with JUnit Run/Debug Configuration?
2017.3 version introduces configurable command line shortener when classpath is too long. Please see related blog post. Also you could try to change it manually in .idea/workspace.xml file, see What does the dynamic.classpath flag do.
Please post complete textual output from console Run(Debug) tool window when you launch the tests with the 'JAR manifest' option and 'classpath file' option where the full command line and the error would be seen.
Do you use any custom classloaders?
Alex, your problem seems different. Is in this thread we are discussing that Shorten command line option does not work and the same error is reported. In your case seems that the option helped for the initial issue but then test fails because of a different problem. Can you provide a sample test case? Or at least the full textual output you see when test fails fo you. How do you load the file in your code?
Are there any solutions to the issues I'm facing?
to find a solution we must understand the problem. Could you please kindly provide the information requested? Thanks.
I updated https://intellij-support.jetbrains.com/hc/en-us/community/posts/360000140604/comments/360000086164 with the information from the console. Also, I don't believe I am using any custom class loaders in these scenarios.
I see another error in the included console output:
Which looks like the https://youtrack.jetbrains.com/issue/IDEA-143187 issue (see the workaround), and not the originally reported issue. Please clarify.
I have tried the following (https://youtrack.jetbrains.com/issue/IDEA-143187#comment=27-1339297) :
This allows me to run the unit test within the IDE.
Also, you are correct. By using the workaround you suggested we exposed another issue (https://youtrack.jetbrains.com/issue/IDEA-143187), which also has a workaround stated above.
The original issue is that I get the following:
>The original issue is that I get the following:
We need full textual output from the Console tab when you are getting this error. Please post it here when you have the option Classpath file selected in Run Configuration. Thanks.
After making the change in Build, Execution, Deployment > Build Tools > Maven > Running Tests and uncheck the argLine, The tests will run, so I'm not running into issues there. Just in the case where none is being used where that flag is set.
Alex Fanshawe's solution of downgrading to 2017.2 worked great (I had just upgraded to 2018.1). I couldn't even find where the error was displayed. I just kept trying to run a test in 2018 and it wouldn't respond. No errors in the log, it just quietly did nothing.
I'm not really sure what the build command is. I have some corp plugin that mostly retrieves ~900+ packages from a corp server, and handles linking and such. Presumably, it may be affecting the situation.
On OSX 10.12.6 Sierra
What Run/Debug configuration type do you use? Please provide a screenshot of the configuration. What is the value of the Shorten command line option in this configuration?
@SergeBaranov: see my edited post. The problem started today.
I used to run this Spring Boot application without any problem still about a month ago. Today before launching I upgraded IDEA.
Try 2018.2.1 version. Report a bug with the sample project attached at https://youtrack.jetbrains.com/issues/IDEA if the issue persists.
@SergeBaranov: I have tried the newest version as you had suggested. Still the same issue. However I am not permitted to upload the project, sorry.
The screensharing session would be much faster as creating a dummy project. I do not know where the root cause is. And it is difficult to reduce the existing project, as other Spring Boot applications I have launch without the error.
Screen sharing will not help, try to create a dummy project to reproduce it or at least submit a report with the logs.
@SergeBaranov: The problem is most probably somewhere in our application. We upgraded a lot of libraries at the same time and probably some default folders changed. I will try to figure it out. It looks like the fault is not on the side of IntelliJ IDEA.
Hi, I'm running 2018.2.3, Windows 10 (probably latest, it complains and updates almost every day), Java 10 and encountering the same issue. My project is running gradle so not sure if the maven quick fix will work. I swear it was working yesterday, and today it stopped working. Maybe I need a restart or gradle clean or invalidate caches.
Maybe this is a throwback to the issue with Windows 10 not being able to run commands longer than X characters, aye.
Works on my Ubuntu VM.
This issue is about Win only. You need to choose command line shortening method from suggested list.
Hi Anna, thank you for the clarification. I'll try it out!
Faced with a similar problem. Solution found?
Have you tried "command line shortening" option?
Just updated to 2018.3.5 and have the same issue, on 2018.3.4 tests were run fine.
I set "shorten command line line" = "user-local default: none"
But it haven't helped.
Also I didn't get the solution from the discussion above. What is it?
Please report at https://youtrack.jetbrains.com/issues/IDEA and attach the full output from the run console and the error you get.
I'd also same issue, I set JRE to > "JRE Path in Program files" and Shorten Line command > "JAR manifest".
Then, it will work fine.