In most ClassLoaders
ClassLoader classLoader = Thread.currentThread().getContextClassLoader()
classLoader.getResources("");
will return an enumeration that includes directories that contain the class files as well as any jars on the class path. However when executing this code within a maven surefire execution the only items returned are the class and test-class directories. It seems to make no difference if I use the useSystemClassLoader
or useManifestOnlyJar
properties to adjust the class loader. In addition the class loader (as seen via an attached debugger) appears to have a number of jars attached.
To make things stranger, the debugger shows that the surefire class loader is an instance of the same type as when not running inside surefire.
Does anyone have any pointers for diagnosing the differences or ideas as to how to fix the problem?
Claude