boolean () { Set<Library> unusedLibraries = new HashSet<>(); Collections.addAll(unusedLibraries, myModelsProvider.getAllLibraries()); for (ModuleRootModel eachModel : collectModuleModels()) { for (OrderEntry eachEntry : eachModel.getOrderEntries()) { if (eachEntry instanceof LibraryOrderEntry) { unusedLibraries.remove(((LibraryOrderEntry)eachEntry).getLibrary()); } } } boolean removed = false; for (Library each : unusedLibraries) { if (!isDisposed(each) && MavenRootModelAdapter.isMavenLibrary(each)) { if (!MavenRootModelAdapter.isChangedByUser(each)) { myModelsProvider.removeLibrary(each); removed = true; } else { MavenImportCollector.HAS_USER_MODIFIED_IMPORTED_LIBRARY.log(myProject); } } } return removed; }