How do I use a template code generator (eg freemarker) in Maven?

后端 未结 2 2029
终归单人心
终归单人心 2021-02-19 14:55

How would you structure Freemarker (or an alternative) as a templating code generator into a Maven project? I\'m pretty new to Maven and would appreciate some help.

I wa

2条回答
  •  执念已碎
    2021-02-19 15:58

    Here is another plugin for the job: https://code.google.com/p/maven-replacer-plugin/

    From the original description of the problem it sounds like you should consider creating a Maven Archetype (aka Project Template): http://maven.apache.org/archetype/maven-archetype-plugin/

    And it sounds like you might want to add some properties into the equation: http://maven.apache.org/archetype/maven-archetype-plugin/examples/create-with-property-file.html

    Maven Archetype functionality also provides a means of doing substitution using Apache Velocity (near enough the same as Freemarker) ... but I haven't worked that bit out yet.

提交回复
热议问题