void (final Module module) { super.initModule(module); ModuleRootModificationUtil.updateModel(module, model -> { LibraryTable libraryTable = model.getModuleLibraryTable(); for (Lib lib : myLibraries) { Library library = libraryTable.createLibrary(lib.getName()); Library.ModifiableModel libraryModel = library.getModifiableModel(); boolean success = false; try { for (OrderRootType rootType : OrderRootType.getAllTypes()) { for (String root : lib.getRoots(rootType)) { VirtualFile vRoot = LocalFileSystem.getInstance().refreshAndFindFileByPath(root); if (vRoot != null && OrderRootType.CLASSES.equals(rootType) && !vRoot.isDirectory()) { VirtualFile jar = JarFileSystem.getInstance().refreshAndFindFileByPath(root + "!/"); if (jar != null) { vRoot = jar; } } if (vRoot != null) { libraryModel.addRoot(vRoot, rootType); } } } success = true; } finally { if (!success) { Disposer.dispose(libraryModel); } } libraryModel.commit(); } for (MavenLib mavenLib : myMavenLibraries) { MavenDependencyUtil.addFromMaven(model, mavenLib.getCoordinates(), mavenLib.isIncludeTransitiveDependencies(), mavenLib.getDependencyScope()); } Sdk jdk; if (myJdk != null) { jdk = IdeaTestUtil.createMockJdkFromLegacyPath(myJdk); if (jdk == null) { VfsRootAccess.allowRootAccess(module, myJdk); jdk = JavaSdk.getInstance().createJdk(module.getName() + "_jdk", myJdk, false); ((ProjectJdkImpl)jdk).setVersionString(StringUtil.notNullize(IdeaTestUtil.getMockJdkVersion(myJdk), "java 1.5")); } } else { jdk = IdeaTestUtil.getMockJdk17(); } registerJdk(jdk, module.getProject()); model.setSdk(jdk); if (myLanguageLevel != null) { model.getModuleExtension(LanguageLevelModuleExtension.class).setLanguageLevel(myLanguageLevel); } else if (myMockJdkLevel == MockJdkLevel.jdk15) { model.getModuleExtension(LanguageLevelModuleExtension.class).setLanguageLevel(LanguageLevel.JDK_1_5); } }); for (OrderEntry entry : ModuleRootManager.getInstance(module).getOrderEntries()) { if (entry instanceof LibraryOrderEntry) { Library library = ((LibraryOrderEntry)entry).getLibrary(); libraryCreated(library, module); } } }