Good day to all:
I am using Gradle 4.6
I have a parent project and a child project. Trying to use the composite build feature.
The child project has the following task in the build.gradle
afterEvaluate {
task fatJar(type: Jar) {
classifier = ‘fat’
from sourceSets.main.output
from {
configurations.runtimeClasspath.files.
findAll { it.name.startsWith(“aaa”) }.
collect { zipTree(it) }
}
exclude ‘META-INF/.RSA’, 'META-INF/.SF’, ‘META-INF/.DSA’, 'META-INF/.EC’
}
artifacts {
archives fatJar
}
build.dependsOn(fatJar)
}
When I call “./gradle build” directly on the child project, 3 files get generated: my.jar, my-fat.jar and my-sources.jar.
When I add includeBuild ‘…/child’ in the parent’s settings.gradle and run ./gradlew build from the parent, only one my.jar gets generated.
The fatJar never gets called.
What is the correct way of generating a fat jar from the parent project?
Thank you.