FMPP - FreeMarker-based file PreProcessor

What is FMPP?

FMPP is a general-purpose text file preprocessing tool that uses FreeMarker templates. It process entire directories recursively. It can be used for generating complete static websites, source code, configuration files, etc. It can insert data from sources like CSV, XML, and JSON into the generated files. (You can add new kind of data sources in Java.) See the Tutorial for a more concrete introduction.

FMPP can be used with UN*X-style command-line interface, or as Ant task, or can be embedded into your application using its Java API.

FMPP was written in Java, thus it runs on all modern platforms (Windows, "Linux", OS X, etc.).

FMPP is Free software under Apache License 2.0. See license...


A quick list of FMPP capabilities:

  • FreeMarker as the preprocessor language:
    • All the usual template constructs, such as include, if/else/elseif, loop.
    • Macros with named arguments and nested content (body).
    • Variables (global, or local for a macro call)
    • Complex expressions using string, arithmetical and logical operations.
    • Extensible with custom functions.
    • Automatic and manual escaping (HTML, XML, custom function)
    • Transforming (filtering) blocks of output; extensible with custom transformations in Java.
    • Capturing block of output into a variable.
    • Charset aware, internally uses UNICODE.
    • Number and date/time formatting with masks (patterns). Locale sensitive formatting.
  • Bulk file processing:
    • Process entire directories recursively.
    • Different file processing mode can be chosen for each file, based on path patterns (as file extension): execute file as template, or parse it as XML and then render it to output with a template, or binary-copy it, or ignore it.
    • Can ignore bad source files and log the error message into a text file.
    • Can guarantee that certain files will be processed later than others.
  • You can expose data from arbitrary data sources be writing extensions in Java. Currently out-of-the-box supported data sources:
    • XML file
    • CSV and tab-separated text file
    • JSON file
    • Java "properties" file
    • Ant properties, Ant project and target information
    • System clock
    • Plain text file
  • Other highlighted features:
    • Output splitting: a single source file can generate multiple output files (including 0 output files).
    • Automatic file inclusion, automatic escaping, and whatnot that can be done with automatically inserted headers and footers, chosen based on path patterns.
    • Generate HTML <img>-s with calculated width and height.
    • Calculate the relative path to the home directory, or to any other file.
    • Rendering (transforming) XML files with FreeMarker templates. (Similar to the typical XSLT usage pattern.)
    • Query the size/existence of source files.
    • Query output encoding (charset).
    • URL-escaping (with the actual output charset).


This on-line documentation is for FMPP version 0.9.15 + FreeMarker 2.3.21. The full documentation of the version you are using can be found in the docs directory of the installed FMPP.


The latest released version is FMPP 0.9.15 (comes with FreeMarker 2.3.21, but you can replace it with a later version).

Downloads include "binaries", all documentation, and source code.

Installation instructions...

Change log (version history)...

FMPP is a Java application so it requires Java to be installed on your machine (version 1.4 or later).

The FMPP Ant task (ignore if you don't know what Ant is) requires Ant 1.5.1 or later.

For text editor and IDE plug-ins and other FreeMarker template-related tools, please visit the FreeMarker homepage:


Help: Ask on Stack Overflow with "fmpp" tag.

Suggestions: Use the Feature Request tracker, or write to (delete the "REMOVETHIS"!)

Please report bugs and documentation mistakes you find on the bug tracker or to (delete the "REMOVETHIS"!)!

Report FreeMarker bugs on the FreeMarker bug tracker, not on the FMPP bug tracker. (If you are not sure which is it, then just report on any of them.)