LibraryOrderEntry (@NotNull IdeModifiableModelsProvider modelsProvider, @NotNull final LibraryDependencyData libraryDependencyData, @NotNull final Library library, @NotNull final ModifiableRootModel moduleRootModel, @NotNull final Module module) { final Library.ModifiableModel libraryModel = modelsProvider.getModifiableLibraryModel(library); final String libraryName = libraryDependencyData.getInternalName(); final LibraryData libraryDependencyDataTarget = libraryDependencyData.getTarget(); Map<OrderRootType, Collection<File>> files = ProjectDataService.EP_NAME.findExtensionOrFail(LibraryDataService.class) .prepareLibraryFiles(libraryDependencyDataTarget); Set<String> excludedPaths = libraryDependencyDataTarget.getPaths(LibraryPathType.EXCLUDED); LibraryDataService.registerPaths(libraryDependencyDataTarget.isUnresolved(), files, excludedPaths, libraryModel, libraryName); LibraryOrderEntry orderEntry = findLibraryOrderEntry(moduleRootModel, library, libraryDependencyData.getScope()); assert orderEntry != null; setLibraryScope(orderEntry, library, module, libraryDependencyData); return orderEntry; }