Interface MinimizeSpec


public interface MinimizeSpec
Configures the optional scoping block on minimize { ... } (see ShadedJarExtension). Without this block, every class in every bundled dependency that the reachability analysis can't prove is used gets dropped.

keep takes the same small pattern language relocation's include/exclude already use — see NamePatterns: either an exact dotted class name ("com.example.Foo") or a prefix wildcard ("com.example.**", matching that package and everything nested under it). A class matching any keep pattern is never dropped, regardless of what the reachability analysis concluded.

   minimize {
       // Only ever looked up by name via ServiceLoader/reflection, so the
       // static reachability analysis can't see it's actually used.
       keep 'com.example.plugin.ReflectivelyLoadedThing'
       keep 'org.some.plugin.**'
   }
 
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    keep(String... patterns)
     
  • Method Details

    • keep

      void keep(String... patterns)