Home > Model Transformation > Model-to-Text (M2T) > OOMEGA Generator > Compile Templates
As soon as you are ready with template programming, you compile them. Template compilation is managed by org.oomega.generator.JGenC. The command line arguments specify the source directory containing the templates and a destination directory for the resulting Java template files. JGenC processes all files with the suffix ".jgen" in the directory structure specified by source.
<java classname = "org.oomega.generator.JGenC" fork = "true" failonerror = "true" classpath = "etc/:${oomega.home}/lib/oomega-generator.jar:${oomega.home}/lib/oomega-core.jar" > <arg line = "-source src/jgen" /> <arg line = "-dest build/temp/generate/jgen-classes" /> </java>
For a convenient usage within Ant environments, we provide a particular Ant-Task <jgenc>. To make the OOMEGA Ant-Tasks available they have to be included, first:
<taskdef resource="org/oomega/generator/ant/antlib.xml" classpath="etc/:${oomega.home}/lib/oomega-generator.jar:${oomega.home}/lib/oomega-core.jar" />
Using the OOMEGA Ant-Task, template compilation is done as follows:
<jgenc> <source dir="src/jgen" /> <dest dir="build/temp/generate/jgen-classes" /> </jgenc>
The resulting Java source files are post processed with a standard Java compiler.
<javac srcdir = "build/temp/generate/jgen-classes/" destdir = "build/temp/templates/" debug = "on" encoding = "UTF-8" classpath = "${oomega.home}/lib/oomega-generator.jar:${oomega.home}/lib/oomega-core.jar" />
Next chapter: Generate Source Code