On Windows I was trying to run a unit test in IntelliJ which was not able to run because the command was too long. IntelliJ was suggesting to use @argfile to shorten the command.
However when doing that I was getting this exception when running the test:

Exception in thread "main" java.lang.NoClassDefFoundError: org/junit/platform/engine/TestDescriptor
	at java.base/java.lang.Class.forName0(Native Method)
	at java.base/java.lang.Class.forName(Class.java:375)
	at com.intellij.rt.junit.JUnitStarter.getAgentClass(JUnitStarter.java:241)
	at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:222)
	at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:55)
Caused by: java.lang.ClassNotFoundException: org.junit.platform.engine.TestDescriptor
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
	... 5 more

You can also use JAR manifest as command shortener, this did not work for me. Spring context was trying to start, but since this project was doing a lot reflection and resource loading, I was getting an exception that an resource was not found.

Solution

You might have too many dependencies causing a commandline command which is too long. Every dependency is added as classpath argument by it's absolute path. So if you have a long username your .m2 path will look like this:

C:\Users\LastnameFirstname\.m2\repository

I solved it by moving my .m2\repository to C:\.m2\r.

Changed the local repository path in my C:\Users\<name>\.m2\settings.xml

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
		  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
		  xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">

 <localRepository>C://.m2/r</localRepository>
...
</settings>

Verify your maven repository in IntelliJ Maven settings.