public static void appendProjectLibraries(final Project project, @Nullable final File userLibrariesFile) throws IOException {
    if (userLibrariesFile == null) return;
    if (userLibrariesFile.exists() && !userLibrariesFile.isFile()) return;
    final File parentFile = userLibrariesFile.getParentFile();
    if (parentFile == null) return;
    if (!parentFile.isDirectory()) {
      if (!parentFile.mkdir()) return;
    }
    final Element userLibsElement = new Element("eclipse-userlibraries");
    final List<Library> libraries = new ArrayList<>(Arrays.asList(LibraryTablesRegistrar.getInstance().getLibraryTable(project).getLibraries()));
    ContainerUtil.addAll(libraries, LibraryTablesRegistrar.getInstance().getLibraryTable().getLibraries());
    for (Library library : libraries) {
      Element libElement = new Element("library");
      libElement.setAttribute("name", library.getName());
      writeUserLibrary(library, libElement);
      userLibsElement.addContent(libElement);
    }
    JDOMUtil.writeDocument(new Document(userLibsElement), userLibrariesFile, "\n");
  }
public static void appendProjectLibraries(final Project project, @Nullable final File userLibrariesFile)