Freemarker Maven Plugin

Maven Plugin for using the FreeMarker template engine in builds

License

License

Categories

Categories

Maven Build Tools
GroupId

GroupId

de.steffendingel
ArtifactId

ArtifactId

freemarker-maven-plugin
Last Version

Last Version

1.0.0
Release Date

Release Date

Type

Type

maven-plugin
Description

Description

Freemarker Maven Plugin
Maven Plugin for using the FreeMarker template engine in builds
Project URL

Project URL

https://github.com/sdingel/freemarker-maven-plugin
Source Code Management

Source Code Management

https://github.com/sdingel/freemarker-maven-plugin

Download freemarker-maven-plugin

How to add to project

<plugin>
    <groupId>de.steffendingel</groupId>
    <artifactId>freemarker-maven-plugin</artifactId>
    <version>1.0.0</version>
</plugin>

Dependencies

compile (5)

Group / Artifact Type Version
org.apache.maven : maven-plugin-api jar 3.6.3
org.apache.maven.shared : file-management jar 3.0.0
javax.json : javax.json-api jar 1.1
org.glassfish : javax.json jar 1.1
org.freemarker : freemarker jar 2.3.30

provided (1)

Group / Artifact Type Version
org.apache.maven.plugin-tools : maven-plugin-annotations jar 3.6.0

Project Modules

There are no modules declared in this project.

FreeMarker Maven Plugin

GitHub Workflow Status (branch) Maven Central GitHub

Maven Plugin for using the FreeMarker template engine in builds

Usage

To use the plugin, place the following plugin element into your pom.xml under project/build/plugins (adjust the configuration element to your needs, see below):

<project>

    <build>
    
        <plugins>
        
            <plugin>
                <groupId>de.steffendingel</groupId>
                <artifactId>freemarker-maven-plugin</artifactId>
                <version>1.0.0</version>
                <executions>
                    <execution>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>freemarker</goal>
                        </goals>
                        <configuration>
                            <templateDirectory>${project.basedir}/src/main/freemarker</templateDirectory>
                            <templateName>simple-template.ftl</templateName>
                            <inputFiles>
                                <directory>${project.basedir}/src/main/model</directory>
                            </inputFiles>
                            <outputDirectory>${project.build.directory}/html</outputDirectory>
                            <outputExtension>html</outputExtension>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

        </plugins>

    </build>

</project>

Currently, the plugin supports only one goal freemarker:freemarker which applies a FreeMarker template to a set of JSON input files, writing one output file for each input file. By default, this goal binds to the Maven lifecylce phase generate-resources.

The goal supports the following configuration parameters:

  • templateDirectory (optional, default is ${project.basedir}/src/main/freemarker): Directory where the FreeMarker templates are located.
  • templateName (required): Name of the FreeMarker template file (including the extension).
  • inputFiles (required): Set of JSON input files (models) for FreeMarker. The path of each file relative to the base directory of the file set is used to determine the output file path.
  • outputDirectory (required): Directory to write the output files to. The output files are written in the same structure as the input files are found in the inputFiles file set.
  • outputExtension (required): File extension of the output file (without the dot).

Versions

Version
1.0.0