How to inspect the current classpath
Sometimes you wonder which JAR files are really in the classpath of your application. For Maven projects when debugging Unit tests the IDE should compute the classpath automatically from POM files. But how to debug the classpath if loading of resource files fails?
Consider a unit test for a CoreMedia PageHandler using the XML Repository approach. Usually config files are loaded using java.lang.ClassLoader#getResource():
For Maven modules resource files are usually located below /src/main/resources. To check if the modules JAR file is really loaded the following expression could be used right in the debuggers “Evaluate expression” command:
Arrays.asList(System.getProperty("java.class.path").split(":")).stream().filter(s -> s.contains("my-artifact-name")).toArray()
In this case the JAR file was really missing, and so the resource file. The solution was quite simple: Just give IntelliJ a click on “Reimport all Maven projects“.