I have created a simple Gradle Java project. The build.gradle
file looks like this:
plugins {
id 'java'
}
repositories {
mavenCentral()
}
dependencies {
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.10'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.6.0'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.6.0'
}
test {
useJUnitPlatform()
}
task customFatJar(type: Jar) {
archiveBaseName = 'fat-jar'
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
with jar
}
I am creating the fat jar
according to https://www.baeldung.com/gradle-fat-jar.
However, the resulting jar does not contain the commons-lang3
library. It only contains the project's class files.
Why isn't my library included in the fat jar
?
configurations.compile.*
– Agrestic