Templating
App Component Templates use Jinja as the templating engine. When a new Application Component is created from a template, CodeNOW processes the template repository and replaces all Jinja expressions with values provided by the developer in the component creation form.
The keys available in Jinja expressions are defined in Component Configuration. Every property_key you define there becomes a variable you can reference in the template repository.
In addition, CodeNOW automatically provides the built-in key componentName — its value is the name of the component entered by the developer during creation. You can use it in the template the same way as any other property key.
What Gets Processed
The template engine processes files and directory names inside the directories specified in Templating Rules → Expand Folders. Files and paths listed under Ignored Files / Directories are copied as-is without any processing.
The following parts of the repository are subject to templating:
| Target | Example |
|---|---|
| File content | Any file inside a processed directory |
| File names | {{ artifact_id }}.java → MyService.java |
| Directory names | {{ group_id }} → com.example or com/example (depending on Expand Folders) |
Jinja Syntax
Use standard Jinja2 syntax in file contents and file/directory names:
{{ property_key }}
Full Jinja2 feature set is available — conditions, loops, filters, and more:
{% if some_property == 'value' %}
...
{% endif %}
{% for item in list_property %}
...
{% endfor %}
{{ property_key | lower }}
{{ property_key | replace('.', '/') }}
Preparing the Repository
To set up a template repository:
- Define properties in Component Configuration — each
property_keybecomes a Jinja variable - Use
{{ property_key }}expressions in file contents, file names, and directory names where you want values substituted - Configure Templating Rules — specify which directories should be processed and which files should be excluded
- Validate using Dry Run before publishing