A Gradle plugin to embed dependencies (A.K.A. fat or uber jar) in the produced jar. It can optionally repackage the classes
Apply the plugin:
plugins {
java
id("io.github.gmazzo.dependencies.embedded") version "<latest>"
}
dependencies {
embedded("org.apache.commons:commons-lang3:3.14.0")
}Then the jar task will have the classes from org.apache.commons:commons-lang3:3.14.0 (and it won't be a dependency
when published)
By default, the plugin will just copy the classes from the dependencies to the produced jar. If you want to repackage them, you can use the repackage option:
configurations.embedded {
embedding {
include("com.foo.**")
exclude("com.bar.**")
repackage("(org\\.apache\\.commons)\\.(.*)".toRegex(), "my.$1.repackaged.$2")
}
}