Skip to content
This repository has been archived by the owner on Oct 16, 2022. It is now read-only.

maven-shade-plugin with everything "fixed": class relocation, jar minification, meta-inf service transformers

License

Notifications You must be signed in to change notification settings

immutables/maven-shade-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

maven-shade-plugin

Customized version of maven-shade-plugin.

<groupId>org.immutables.tools</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>4</version>

1. Relocation with $ uglyfication

Allows class relocation patterns to contain $ sign. If pattern ends with $ sign, the dollar sign will be prepended in front of class names. This effectively prevents clashed during code completion.

<relocation>
  <pattern>com.google.common</pattern>
  <shadedPattern>com.my.internal.$guava$</shadedPattern>
</relocation>

The above pattern will result in ImmutableList being relocated as

com.my.internal.$guava$.collect.$ImmutableList

2. ServiceResourceTransformer that actually works properly

  • Merges META-INF/services/* entries with deduplication of lines
  • Applied class relocations to merged entries

3. Minimize Jar that works properly

  • Does not remove used classes: fixed transitive class dependencies problem.
  • Does not remove classes used in META-INF/services/* for used service types. Removes META-INF/services/* for unused service types. Explicitly include META-INF/services/** in filters to not delete such files and make all provider implementation types marked as non-removable.

I would love someone to contribute/reimplement those changes to the original Apache Maven maven-shade-plugin. I just couldn't afford time to dive into processes or infrastructure there.

About

maven-shade-plugin with everything "fixed": class relocation, jar minification, meta-inf service transformers

Resources

License

Stars

Watchers

Forks

Packages

No packages published