[
https://issues.apache.org/jira/browse/AVRO-2940?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Nicolas updated AVRO-2940:
--------------------------
Description:
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.
was:
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.
> 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
>
> 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)