Code generator framework for Java for easy and quick declaration and usage of code generators.
Example generators can be found inside the module cgf4j-example-generators
. The use of Xtend is optional but recommended because the templating engine is very powerful. See the Xtend documentation for more information.
- Add
cgf4j-api
andorg.eclipse.xtext.xbase.lib
to your dependencies - Include the
xtend-maven-plugin
inside your build - Declare classes extending
FileGenerator
fromcgf4j-api
- Override the necessary methods to define the relative path, file name, file extension, file content and optionally file encoding of the generated file
Example usage can be found inside the module cgf4j-example-usage
.
- Add the
cgf4j-maven-plugin
to your build and include the dependency to your generator module - Configure the
targetPath
and optionally thegeneratorTypes
to use - Use the
build-helper-maven-plugin
to include the generated files