title: FileBasedConfigurationBuilder from Apache Commons Configuration2 not writing the configuration file
body: <p>I need to write a simple configuration file using <code>apache-commons-configuration</code> but no matter what I try, it's not writing anything to the file.</p>
  
  <p>This is how the file should look like</p>
  
  <pre><code>&lt;config&gt;
    &lt;foo&gt;bar&lt;/foo&gt;
  &lt;/config&gt;
  </code></pre>
  
  <p>This is what I'm doing to write the foo configuration:</p>
  
  <pre><code>private static final String USER_CONFIGURATION_FILE_NAME = "config.xml";
  
  private final Path configFilePath = Paths.get(System.getProperty("user.home"), ".myapp",
  USER_CONFIGURATION_FILE_NAME);
  
  private final FileBasedConfigurationBuilder&lt;XMLConfiguration&gt; configBuilder=
    new FileBasedConfigurationBuilder&lt;&gt;(XMLConfiguration.class)
        .configure(new Parameters().xml().setFile(configFilePath.toFile()));
  
  /**
   * Sets the foo configuration to the given {@link String}
   * 
   * @param foo The configuration to be set up
   * @throws ConfigurationException If any error occur while setting the property on the
   *         configuration file
   */
  public void setfoo(final String bar) throws ConfigurationException {
    checkNotNull(bar);
    final Configuration config = configBuilder.getConfiguration();
  
    config.setProperty("foo", bar);
  
    configBuilder.save();
  }
  
  /**
   * Retrieves the foo set up on the configuration file
   * 
   * @return The foo set up on the configuration file
   * @throws ConfigurationException If any error occur while setting the property on the
   *         configuration file
   * @throws NoSuchElementException If there is no foo set up
   */
  public String getFoo() throws ConfigurationException {
    return configBuilder.getConfiguration().getString("foo");
  }
  </code></pre>
  
  <p>Am I missing something? In <a href="https://commons.apache.org/proper/commons-configuration/userguide/howto_filebased.html#File-based_Configurations" rel="nofollow noreferrer">Apache Commons Configuration - File-based Configurations</a> I can't see any other information needed to set up the file, so I really don't know what I'm missing here.</p>
  
  <hr>
  
  <p>For some reason the <code>FileBasedConfiguration</code> is not setting up the xml file by itself, so I had to create it manually and set up the root element, like this:</p>
  
  <pre><code>configFilePath.toFile().createNewFile();
  
  final Writer writer = Files.newBufferedWriter(configFilePath);
  writer.write("&lt;config&gt;&lt;/config&gt;");  //sets the root element of the configuration file
  writer.flush();
  </code></pre>
  
  <p>Shouldn't <code>FileBasedConfiguration</code> take care of this for me, or this is a step that's not documented on <code>apache-commons</code>?</p>