1. Avro
  2. AVRO-941

Avro should support the Apache Maven Shade plugin class relocation feature


    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.5.4
    • Fix Version/s: 1.6.0
    • Component/s: java
    • Labels:


      The Apache shade plugin allows maven builds to create an uber jar that contains dependencies in the project. In addition, the shade plugin allows you to relocate dependencies into a private namespace to prevent class conflicts on shared class paths. Avro does not support relocation.

      All generated Avro objects contain a string field named SCHEMA$ which serves as the authority for the class namespace. When the shade plugin updates the byte code to relocate the class, it doesn't alter the SCHEMA$ string. This break Avro use of reflection since the namespace in SCHEMA$ points to an incorrect location.

      I spoke with Doug about the issue and he was kind enough to provide a quick hack in order to fix this issue. The hack is to check for mismatches between the byte code and the SCHEMA$ and, when they don't match, to defer to the byte code. I'll attach Doug's patch to this Jira.

      1. shade.patch
        2 kB
        Matt Massie


        Doug Cutting made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Doug Cutting made changes -
        Resolution Fixed [ 1 ]
        Status Open [ 1 ] Resolved [ 5 ]
        Assignee Doug Cutting [ cutting ]
        Fix Version/s 1.6.0 [ 12316198 ]
        Matt Massie made changes -
        Field Original Value New Value
        Attachment shade.patch [ 12500337 ]
        Matt Massie created issue -


          • Assignee:
            Doug Cutting
            Matt Massie
          • Votes:
            0 Vote for this issue
            0 Start watching this issue


            • Created: