jinjava-maven-plugin

JinJava Maven Plugin

The JinJava Maven plugin allows you to use static Jinja template files in your application, During build, the template engine replaces variables in a template file with actual values, and produce the final processed output file.

Available from the Central Repository

Usage

ansible

To execute the ansible ping module with the host as localhost

       <plugin>
                      <groupId>io.github.gowrish9595</groupId>
                      <artifactId>jinjava-maven-plugin</artifactId>
                      <version>1.0.0-RC2</version>
                      <executions>
                          <execution>
                              <goals>
                                  <goal>generate-files-for-templates</goal>
                              </goals>
                          </execution>
                      </executions>
                      <configuration>
                          <j2ResourcesDirectory>${project.basedir}/src/main/resources/j2-templates/</j2ResourcesDirectory>
                          <outputDirectory>${project.basedir}/src/main/resources/</outputDirectory>
                          <contextFilePath>${project.basedir}/src/main/resources/config-profiles/host-specific.yml</contextFilePath>
                      </configuration>
                  </plugin>

Goals

generate-files-for-templates

Binds by default to the generate-resources

Parameters

Name | Type | Description | Required | Default :—-|:—-:|:————|:——-: | ——- j2ResourcesDirectory|String| Absolute path of the directory that conatins j2 resources | Yes | - outputDirectory|String| The absolute path of the directory where templated files are generated | Yes | - contextFilePath|String| The absolute path of the variable file (the file should be yaml)| Yes | - isLStripBlocks|boolean| Determine when leading spaces and tabs should be stripped. When set to yes leading spaces and tabs are stripped from the start of a line to a block.| No | false isTrimBlocks|boolean|Determine when newlines should be removed from blocks. When set to yes the first newline after a block is removed | No | true isFailOnUnKnownVariables|boolean| Fail build when a variable in template not in context | No | true

Release Notes

1.0.0 Initial release

Release date: 22-10-2021