Run > Edit Configurations... Select a test (better to select a parent test class) and set a Shorten command line: option to classpath file . Then OK (or Apply, OK). Using the JAR manifest option in shorten command line worked for me.
In the Run/Debug Configuration dialog, a new field appeared: Shorten command line. The new field allows you to choose the way the IDE will shorten the command line from a drop-down list: None: This is the default option. The IDE doesn't shorten the long classpath.
open workspace. xml file - search for "dynamic. classpath" property and change the value to false. L.E.
In Intellij, go to "edit configurations" (Run -> Edit Configurations), in the configuration tab that comes up in the line "shorten command line" select option "classpath file"/"@argFiles (Java 9+)", last option in the drop down menu. Fixed it for me.
Setting the Shorten command line:JAR manifest
in Run/Debug Configurations resolves the issue.
Open the file .idea/workspace.xml file from your project root folder, go to section
<component name="PropertiesComponent">
and add the following:
<property name="dynamic.classpath" value="true" />
See What does the dynamic.classpath flag do? (IntelliJ project settings).
Not sure what you want to fix. If you need to avoid dynamic classpath, revise your dependencies, move libraries, project files and JDK to a directory with short path.
Edit: the bug you linked in comments makes sense, however what happens is that the command line when running your tests exceeds the OS limit even when using dynamic classpath. This can happen because of lots of command line arguments or options which cannot be shortened by IDEA, as IDEA can only workaround long classpath issue. There is nothing we can do about it, you should revise the way you pass parameters to your app so that the command line length is within limits.
From the IDEA side, we'll improve the handling of such case. This dialog will no longer be displayed when dynamic classpath is already used and you will get another error message about the long command line. I've submitted a new issue for this case.
Did this on Intelij community 2021.1 windows, Worked fine :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With