public static String[] getClassRoots() { String testRoots = System.getProperty("test.roots"); if (testRoots != null) { System.out.println( "Collecting tests from roots specified by test.roots property: " + testRoots); return testRoots.split(";"); } final String[] roots = ExternalClasspathClassLoader.getRoots(); if (roots != null) { System.out.println( "Collecting tests from roots specified by classpath.file property: " + Arrays.toString(roots)); return roots; } else { final ClassLoader loader = TestAll.class.getClassLoader(); if (loader instanceof URLClassLoader) { final URL[] urls = ((URLClassLoader) loader).getURLs(); final String[] classLoaderRoots = new String[urls.length]; for (int i = 0; i < urls.length; i++) { classLoaderRoots[i] = VfsUtil.urlToPath(VfsUtil.convertFromUrl(urls[i])); } System.out.println( "Collecting tests from classloader: " + Arrays.toString(classLoaderRoots)); return classLoaderRoots; } return System.getProperty("java.class.path").split(File.pathSeparator); } }