Ryan, Il giorno lun 24 gen 2022 alle ore 20:02 Ryan Skraba <r...@skraba.com> ha scritto: > > Hello, > > As you note, It currently isn't possible to "pre-shade" Avro, but I > completely understand why you might want to do it! Shading avro is a > common thing to do (see > https://beam.apache.org/documentation/io/built-in/parquet/ for > example). > > I guess we _might_ be able to fiddle with the maven shade plugin to do > the relocating of these classes after compiling the generated classes > (without including the relocated classes in the jar?), but I prefer > your solution of a configuration option passed to the template. It's > more direct and can be done in a single step. > > There's a contribution guide[1], but it boils down to creating a JIRA > and making a PR on github! Don't hesitate to reach out, and thanks > for the suggestion!
Thanks. I will try to put up a patch. Enrico > > Ryan > > [1]: https://cwiki.apache.org/confluence/display/AVRO/How+To+Contribute > > > > On Fri, Jan 21, 2022 at 12:36 PM Enrico Olivelli <eolive...@gmail.com> wrote: > > > > Hello, > > in the Pulsar project we use a shaded version of Avro, that is, we > > package Avro in a uber Java for the Pulsar client by renaming all the > > classes from org.apache.avro to > > org.apache.pulsar.shaded.org.apache.avro. > > > > For this reason users of the Pulsar client cannot generate the Avro > > classes using the Maven plugin because the generated classes expect > > Avro classes with the canonical package name. > > > > For the sake of completeness: you could use a version of the Pulsar > > client without the shaded version of Avro , but that's not always the > > case because in that case the Pulsar client does not shade all of the > > other third party dependencies and it often clashes with other third > > party libraries. > > > > My question is: > > Is it possible to tell the Maven plugin to use a different package > > name for Avro ? > > > > My understanding is that we are using a fixed Velocity template > > https://github.com/apache/avro/blob/44737386cb17a359515f068e7fe9caa0f7bfff70/lang/java/compiler/src/main/velocity/org/apache/avro/compiler/specific/templates/java/classic/record.vm#L22 > > > > I would be happy to contribute a patch following your guide if there > > is no way to achieve that without code changes. > > > > Best regards > > Enrico Olivelli