void (Library library) { ModuleRootManagerEx moduleRootManager = ModuleRootManagerEx.getInstanceEx(getModule()); ModifiableRootModel model = moduleRootManager.getModifiableModel(); LibraryTable table = model.getModuleLibraryTable(); table.removeLibrary(library); model.commit(); }