Search code examples
javaspringintellij-idea

java.lang.ClassNotFoundException: IDEA while trying to run unit tests in IntelliJ


Basically, I've been having some issues with intelliJ lately and for the most part I've been able to get them fixed, but today after fixing yet another issue, I just started not being able to run my tests properly.

I tried invalidating caches, removing the .idea folder and reimporting the project, completely uninstalling intellij and removing all files it left behind followed by reinstalling it again, but it just doesn't seem to want to go back to working as it used to.

Every time I run the tests for more than 1 module this is what happens: enter image description here

I'm just running the normal "Run 'All Tests'" option under intellij's right click menu, nothing fancy. Tests seem to run fine when I just do 1 module at a time or when I run the tests through maven. Anyone has any ideas?


Solution

  • So after a lot of fiddling around I ended up finding out what was causing the issue.

    In my specific case, intelliJ was using the "@argfile" option for shorten command line on the junit run configuration. While this is a java 11 project, for some reason this option that is supposed to be used on java 9+ projects isn't working, and when I switched the option back to JAR manifest the tests started running without any issue.

    enter image description here