@Test public void findOne() throws IOException { File root = getRelativePackagePath("mainclass/one"); List<String> ret = ClassUtil.findMainClasses(root); assertEquals(1,ret.size()); assertEquals("sub.OneMain", ret.get(0)); }
public static List<String> findMainClasses(File rootDir) throws IOException { List<String> ret = new ArrayList<>(); if (!rootDir.exists()) { return ret; } if (!rootDir.isDirectory()) { throw new IllegalArgumentException(String.format("Path %s is not a directory",rootDir.getPath())); } findClasses(ret, rootDir, rootDir.getAbsolutePath() + "/"); return ret; }
ClassUtil { public static List<String> findMainClasses(File rootDir) throws IOException { List<String> ret = new ArrayList<>(); if (!rootDir.exists()) { return ret; } if (!rootDir.isDirectory()) { throw new IllegalArgumentException(String.format("Path %s is not a directory",rootDir.getPath())); } findClasses(ret, rootDir, rootDir.getAbsolutePath() + "/"); return ret; } }
ClassUtil { public static List<String> findMainClasses(File rootDir) throws IOException { List<String> ret = new ArrayList<>(); if (!rootDir.exists()) { return ret; } if (!rootDir.isDirectory()) { throw new IllegalArgumentException(String.format("Path %s is not a directory",rootDir.getPath())); } findClasses(ret, rootDir, rootDir.getAbsolutePath() + "/"); return ret; }  }
ClassUtil { public static List<String> findMainClasses(File rootDir) throws IOException { List<String> ret = new ArrayList<>(); if (!rootDir.exists()) { return ret; } if (!rootDir.isDirectory()) { throw new IllegalArgumentException(String.format("Path %s is not a directory",rootDir.getPath())); } findClasses(ret, rootDir, rootDir.getAbsolutePath() + "/"); return ret; }  static Set<String> getResources(String resource); static Set<String> getResources(String resource, List<ClassLoader> additionalClassLoaders); static Class<T> classForName(String className, List<ClassLoader> additionalClassLoaders); static List<String> findMainClasses(File rootDir); static URLClassLoader createProjectClassLoader(List<String> elements, KitLogger log); }
ClassUtil { public static List<String> findMainClasses(File rootDir) throws IOException { List<String> ret = new ArrayList<>(); if (!rootDir.exists()) { return ret; } if (!rootDir.isDirectory()) { throw new IllegalArgumentException(String.format("Path %s is not a directory",rootDir.getPath())); } findClasses(ret, rootDir, rootDir.getAbsolutePath() + "/"); return ret; }  static Set<String> getResources(String resource); static Set<String> getResources(String resource, List<ClassLoader> additionalClassLoaders); static Class<T> classForName(String className, List<ClassLoader> additionalClassLoaders); static List<String> findMainClasses(File rootDir); static URLClassLoader createProjectClassLoader(List<String> elements, KitLogger log);  }