Wednesday, August 15, 2018, 8:02:06 PM, Woonsan Ko wrote:
[...]
> Isn't the json file intended for model provision to the FreeMarker template?
> If so, it doesn't look good to me to have "templateName" in the model
> json file. Convention might be better as mentioned above.
[...]
My understanding is that you have one json file per output file. In
that approach it's logical that the json file chooses the template.
(Multiple json files may use the same template to generate a file
based on the other data contained inside the json file.)
The more generic approach is that the json file (or whatever format it
should use) chooses both the template and the data file (other than
itself).
> Regards,
>
> Woonsan
>
>>
>> Installation pom.xml
>>
>> Add the following snippet within the <plugins> tag of your pom.xml:
>>
>> <plugin>
>> <groupId>com.oath</groupId>
>> <artifactId>freemarker-maven-plugin</artifactId>
>> <version>${freemarker-maven-plugin.version}</version>
>> <configuration>
>> <!-- Required. Specifies the compatibility version for
>> template processing -->
>> <freeMarkerVersion>2.3.23</freeMarkerVersion>
>> </configuration>
>> <executions>
>> <!-- If you want to generate files during other phases, just
>> add more execution
>> tags and specify appropriate phase, sourceDirectory and
>> outputDirectory values.
>> -->
>> <execution>
>> <id>freemarker</id>
>> <!-- Optional, defaults to generate-sources -->
>> <phase>generate-sources</phase>
>> <goals>
>> <!-- Required, must be generate -->
>> <goal>generate</goal>
>> </goals>
>> <configuration>
>> <!-- Optional, defaults to src/main/freemarker -->
>> <sourceDirectory>src/main/freemarker</sourceDirectory>
>> <!-- Optional, defaults to target/generated-sources/freemarker
>> -->
>>
>> <outputDirectory>target/generated-sources/freemarker</outputDirectory>
>> </configuration>
>> </execution>
>> </executions>
>> </plugin>
>>
>> Usage FreeMarker Configuration
>>
>> Typically, users of this plugin do not need to mess with the FreeMarker
>> configuration. This plugin explicitly sets two FreeMarker configurations:
>>
>> 1. the default encoding is set to UTF-8
>> 2. the template loader is set to be a FileTemplateLoader that reads from
>> <sourceDirectory>/template.
>>
>> If you need to override these configs or set your own, you can put them in a
>> <sourceDirectory>/freemarker.properties file. If that file exists, this
>> plugin will read it into
>> a java Properties instance and pass it to
>> freemarker.core.Configurable.setSettings() to establish
>> the FreeMarker configuration. See this javadoc
>> <https://freemarker.apache.org/docs/api/freemarker/template/Configuration.html#setSetting-java.lang.String-java.lang.String->
>> for configuration details.
>> Code Coverage
>>
>> By default the code coverage report is not generated. You can generate code
>> coverage on your dev machine with the following maven command:
>>
>> mvn clean initialize -Dclover-phase=initialize
>>
>> Bring up the coverage report by pointing your browser to
>> target/site/clover/dashboard.html
>> under the root directory of the local repository.
>> Contribute
>>
>> See Contributing.md
>> License
>>
>> Licenced under the Apache 2.0 license. See: LICENSE.txt
>>
>> —
>> Benjamin Grant Jackson
>
--
Thanks,
Daniel Dekany