void (@NotNull Module module, String libName, @NotNull String libDir, String @NotNull [] classRoots, String @NotNull [] sourceRoots) { String proto = (classRoots.length > 0 ? classRoots[0] : sourceRoots[0]).endsWith(".jar!/") ? JarFileSystem.PROTOCOL : LocalFileSystem.PROTOCOL; String parentUrl = VirtualFileManager.constructUrl(proto, libDir); List<String> classesUrls = new ArrayList<>(); for (String classRoot : classRoots) { classesUrls.add(parentUrl + classRoot); } List<String> sourceUrls = new ArrayList<>(); for (String sourceRoot : sourceRoots) { sourceUrls.add(parentUrl + sourceRoot); } ModuleRootModificationUtil.addModuleLibrary(module, libName, classesUrls, sourceUrls); }