registry icon indicating copy to clipboard operation
registry copied to clipboard

schema-registry-core: produce a separate artifact containing core library only

Open bitbrain opened this issue 6 years ago • 0 comments

Problem

The project com.hortonworks.registries:schema-registry-core is configured to produce a "fat jar" artifact. This means, all required class files are packed into the same .jar file to allow execution of that .jar file.

However, other schema-registry modules depend classes from schema-registry-core, even if the intention of these modules is not to directly execute the .jar file. This leads to undesired side effects, since that particular schema-registry-core jar file is now on the classpath on any project depending on this schema registry. It contains a lot of additional class files (older Spring class files, Avro class files). This potentially leads to classfile conflicts. Another side effect is that it is not possible to override/remove dependencies coming from the core artifact, since all class files are directly part of the .jar file, instead having them defined as a pom file dependency.

Solution

Change the Maven shade plugin inside the schema core project to generate multiple artifacts:

  • the default artifact should not be executable and should only contain classfiles compiled from the core project. It should produce a lightweight library jar which can be referenced by other projects
  • define an additional configuration to generate an executable jar containing all required classfile dependencies to execute it

Similar issues: #223

bitbrain avatar Dec 06 '18 13:12 bitbrain