The template component of ModelAnt 2.25 is migrated as follows:
As of the convention above:
engine = TemplateEngineFactory.constructEngine(templateCompilationContext)
engine = TemplateEngineFactory.getEngine(uniqueName)
engine.render(targetFile, targetObject, templateName, bindings)
engine.render(targetObject, templateName, context)
The template is identified by the class name of the object to render and the template name (when provided explicitly) or the name of the calling method in engine.render(targetObject, context).
The templates are stored in files with .jsp extension in order to reuse existing JSP editors with syntax highlight and additional support in JSP authoring.
<template> ::= {<scriptlet import>|<scriptlet comment>}{<template element>}
<scriptlet import> ::= "<%@" <import> "%>" <import> ::= standard java import declaration
<template element> ::= <static text> | <expression> | <scriptlet> | <scriptlet comment>
<static text> ::= string of any charaters, not containing <% substring
<expression> ::= "<%=" <java expression> "%>" <java expression> ::= standard expression in Java
<scriptlet> ::= "<%" <java statement> "%>"
<java statement> ::= <java fragment> {"%>" <template element> "<%" <java fragment>}
<scriptlet comment> ::= "<%--" text "--%>"
NOTE: The syntax of of the templates is changed (simplified), compared to the syntax in 2.25 version.
According to the ModelAnt conventions for Maven, the templates are located in /src/template project directory
Any use of the modelant Templates should use the following dependencies:
<dependencies>
<dependency>
<groupId>net.mdatools</groupId>
<artifactId>modelant.template.api</artifactId>
<version>${revision}</version>
</dependency>
</dependencies>
The use of modelant Templates can be integrated in modelant or independent of modelant. The following depedency is just enough to run:
<dependencies>
<dependency>
<groupId>net.mdatools</groupId>
<artifactId>modelant.template.impl</artifactId>
<version>${revision}</version>
</dependency>
</dependencies>