[ https://issues.apache.org/jira/browse/AVRO-2940?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17223989#comment-17223989 ]
Nicolas commented on AVRO-2940: ------------------------------- Thanks for the encouragement [~rskraba], I just attached a patch with half of the change I am thinking of. This patch refactors the schema compiler a little to consider multiple template directories. If this approach makes sense, then you can probably guess how I'll use the new method {code:java} public void addTemplateOverride(String templateDir){code} in the maven plugin to allow an ordered list to be loaded from the configuration > Add velocity template overrides to maven plugin > ----------------------------------------------- > > Key: AVRO-2940 > URL: https://issues.apache.org/jira/browse/AVRO-2940 > Project: Apache Avro > Issue Type: Improvement > Components: java > Reporter: Nicolas > Priority: Major > Attachments: AVRO-2940.patch > > > h3. Context > In my team, we are exploring creating java classes for our internal teams > with additional customizations like adding annotations to the output java > class from .avsc. To do this, we have modeled off of the maven-plugin module. > Ultimately we needed to create a custom record.vm template and set our own > templateDirectory in the classpath of our custom wrapping jar. > {code:java} > final SpecificCompiler compiler = new SpecificCompiler(protocol); > compiler.setTemplateDir(templateDirectory); {code} > h3. Problem > Even though we are only overriding a subset of the velocity templates, we are > copy pasting all of the templates from the compiler module. The > SpecificCompiler class can only handle a single directory and assumes we can > just append > {code:java} > templateDir + "<template>.vm" {code} > h3. Idea for improvement > I am wondering if it's worth exploring having users of the compiler take a > list of directories. We can use the ordering to determine the priority of the > template so that users like me could provide our local directory at the head > with only our overrides present. > For backwards compatibility, we can keep the existing setter method. The > result of that is a singleton list. As part of this, we could create > .addTemplateOverride() on the compiler which would prepend. -- This message was sent by Atlassian Jira (v8.3.4#803005)