Skip to content

cuzfrog/gradle-lean

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

53 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status Plugin version

Gradle-lean

A gradle plugin that minimizes dependency jars.

Motivation

We have maven-shade to help us minimize jars. But when it comes to gradle, the similar plugin gradle-shadow doesn't do the favor. This project is to provide a lightweight way to reduce the size of an java application distribution package on the fly.

This plugin depends on JavaPlugin and ApplicationPlugin.

  • for installDist, jars under install/$PROJECT_NAME$/lib/
  • for distZip, jars under /lib/ inside package

will be minimized by respective lean tasks.

Todo list:

  • resolve current issues
  • lean for distTar
  • customized jars

How to use:

Add gradle-lean plugin to build:

plugins {
    id "com.github.gradle-lean" version "0.1.2"
}

Execute gradle tasks:

  • installDistLean will trigger installDist and then minimize the jars.
  • distZipLean will trigger distZip and then minimize the zip archive.

Exclusions

Class or dependency jar exclusion can be set in build.gradle:

leanConfig {
    excludedClasses = [
            "com.google.common.cache.*",
            "com.google.common.io.ByteSink"
    ]
    excludedDependencies = [
            "com.google.jimfs:jimfs:1.1"
            //or "com.google.jimfs:jimfs:*"
    ]
}

About:

Author: Cause Chung([email protected]) License: Apache-2.0