Problems with testing in IntelliJ
Importing projects in IntelliJ is usually a problem. I haven’t figured out, why I always end up with projects, that can be build with maven without any problems and IntelliJ fails to find and index the dependencies.
FWIW: I’d expect that the pom is readable for the bundled maven as well.
Sometimes the import fails even more spectacular and the test runner fails with goodies like this:
Exception in thread "main" java.lang.NoClassDefFoundError: org/junit/platform/engine/TestDescriptor
It took me quite some time to figure this out. The problem here is Intellij failed to properly create the modules and assigned paths randomly among them.
That means the classpaths are wrong and the error message makes actually sense.
So when this error happens, open the Module settings inside of Intellij and switch to the modules tab. Verify that there is only one module or rather modules that match the structure of your project.
|IntelliJ usually tells you, when the settings are bogus when you try to quit the dialog via OK.|
Things you should look for:
Same source, test source, ressource path cannot be split/re-used in different modules
Each of the above should exist