Standardize and accelerate the creation of templates-based projects using definining placeholders across any kind of project
Templify is a Maven plugin that helps you generate templates-based from a predefined project using a YAML-based configuration. It supports advanced transformations such as XPath-based replacement in XML files β ideal for managing complex project scaffolding and enforcing consistency.
Templify automates the generation of templates by:
- Reading a YAML config file (
maven-templify.yml
) - Loading project files from a directory
- Applying structured transformations (like XPath replacements in XML)
- Outputting a complete, placeholders templates-based ready to integrate with your Backstage, Jinja and so on
Templify is built for:
- Base Platform teams creating reusable service templates
- Developers automating repetitive setup tasks
- Organizations seeking consistent project standards and faster delivery
You define:
- A template folder containing your base project
- A YAML config file that describes:
- Which files to transform
- How to match content (XPath for XML)
- What to replace
Templify will process the files and generate a project in a specified destination.
maven-templify.yml
:
steps:
- kind: XmlHandler
apiVersion: v1
spec:
- files:
- pom.xml
placeholders:
- match: /project/groupId
replace: templify.param.groupId
- match: /project/artifactId
replace: templify.test.replace.map.artifactId
- match: /project/dependencies/dependency/scope[text()='test']
replace: templify.replace.map.scopes
- files:
- xmls/generic_1.xml
placeholders:
- match: /note/heading
replace: New Reminder
- files:
- xmls/complex/generic_2.xml
placeholders:
- match: /bookstore/book/author[text()='Kurt Cagle']
replace: templify.kurtCagle
- match: /bookstore/book/year[text()='2005']
replace: templify.NewYear
mvn com.thoughtworks.templify:templify:create
π target/template/
βββ pom.xml
βββ xmls/
β βββ generic_1.xml
β βββ complex/generic_2.xml
βββ other project files...
Templify will copy this structure to the target/template
folder and apply the transformations defined in maven-templify.yml
.
- π― XPath JSONPath, YAMLPath, JAva Procjects and Plain Text support for precise targeting your project nodes
- π Batch transformations across multiple files
- πΌ Custom parameter references (e.g.,
templify.param.groupId
) - π§© Composable templates for different types of services or modules
--
Spotted a bug or have a new use case in mind? We welcome contributions, ideas, and questions. Open an issue or submit a PR!