A gradle plugin that minimizes dependency jars.
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 underinstall/$PROJECT_NAME$/lib/
- for
distZip
, jars under/lib/
inside package
will be minimized by respective lean tasks.
- resolve current issues
- lean for
distTar
- customized jars
Add gradle-lean plugin to build:
plugins {
id "com.github.gradle-lean" version "0.1.2"
}
Execute gradle tasks:
installDistLean
will triggerinstallDist
and then minimize the jars.distZipLean
will triggerdistZip
and then minimize the zip archive.
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:*"
]
}
Author: Cause Chung([email protected]) License: Apache-2.0