@Override
  public void execute() throws MojoExecutionException, MojoFailureException {
    assert baseDirectory != null;
    assert targetDirectory != null;
    assert includes != null && includes.length > 0;
    assert excludes != null;

    if (skip) {
      getLog().info("[xml-format] Skipped");
      return;
    }

    final OutputFormat fmt = buildFormatter();

    boolean success = true;
    for (final String inputName : find()) {
      final File input = new File(baseDirectory, inputName); // NOPMD
      final boolean changed;
      try {
        changed = formatInPlace(input, fmt);
      } catch (final DocumentException | IOException ex) {
        success = false;
        getLog().error("[xml-format] Error for " + input, ex);
        continue;
      }
      if (!getLog().isDebugEnabled()) {
        continue;
      }
      final String msg = changed ? "Formatted" : "Unchanged";
      getLog().debug("[xml-format] " + msg + ": " + input);
    }

    if (!success) {
      throw new MojoFailureException("[xml-format] Failed)");
    }
  }