private static void appendToFile(
    @NotNull VirtualFile file,
    @NotNull String templateName,
    @Nullable Map<String, String> templateAttributes
  ) throws ConfigurationException {
    FileTemplateManager manager = FileTemplateManager.getDefaultInstance();
    FileTemplate template = manager.getInternalTemplate(templateName);
    try {
      appendToFile(file, templateAttributes != null ? template.getText(templateAttributes) : template.getText());
    }
    catch (Exception e) {
      LOG.warn(String.format("Unexpected exception on appending template %s config", GradleConstants.SYSTEM_ID.getReadableName()), e);
      throw new ConfigurationException(
        GradleInspectionBundle.message("dialog.message.generate.scripts.error") + "\n" + e.getMessage(),
        UIBundle.message("error.project.wizard.new.project.title", 1)
      );
    }
  }
private static void appendToFile(
    @NotNull VirtualFile file,
    @NotNull String templateName,
    @Nullable Map<String, String> templateAttributes
  )