LibraryEx (@NotNull final Module module, final LibraryTable.ModifiableModel modifiableModel) { RepositoryLibraryProperties libraryProperties = new RepositoryLibraryProperties( libraryDescription.getGroupId(), libraryDescription.getArtifactId(), model.getVersion(), model.isIncludeTransitiveDependencies(), model.getExcludedDependencies()); final LibraryEx library = (LibraryEx)modifiableModel.createLibrary( LibraryEditingUtil.suggestNewLibraryName(modifiableModel, RepositoryLibraryType.getInstance().getDescription(libraryProperties)), RepositoryLibraryType.REPOSITORY_LIBRARY_KIND); LibraryEx.ModifiableModelEx modifiableLibrary = library.getModifiableModel(); RepositoryLibraryProperties realLibraryProperties = (RepositoryLibraryProperties)modifiableLibrary.getProperties(); realLibraryProperties.setMavenId(libraryProperties.getMavenId()); modifiableLibrary.setProperties(realLibraryProperties); ApplicationManager.getApplication().runWriteAction(() -> { modifiableLibrary.commit(); modifiableModel.commit(); }); RepositoryUtils.loadDependenciesToLibrary( module.getProject(), library, model.isDownloadSources(), model.isDownloadJavaDocs(), null); return library; }