Slackbot
09/20/2022, 5:26 AMJendrik Johannes
09/20/2022, 6:06 AMconfigurations.create("specFiles") {
isCanBeResolved = false
isCanBeConsumed = true
attributes {
attribute(Usage.USAGE_ATTRIBUTE, objects.named("spec-files"))
}
outgoing.artifact(resourcesJar)
}
// No artifacts{} block!
And this on the consumer side:
val specFilesPath = configurations.create("specFilesPath") {
isCanBeResolved = true
isCanBeConsumed = false
attributes {
attribute(Usage.USAGE_ATTRIBUTE, objects.named("spec-files"))
}
}
dependencies {
specFilesPath(project(":producer"))
}
See also a full sample here:
Consumer : https://github.com/jjohannes/understanding-gradle/blob/main/13_Aggregating_Custom_[…]gic/java-plugins/src/main/kotlin/my-java-application.gradle.kts
Producer: https://github.com/jjohannes/understanding-gradle/blob/main/13_Aggregating_Custom_[…]uild-logic/java-plugins/src/main/kotlin/my-java-base.gradle.ktsJendrik Johannes
09/20/2022, 6:08 AMJendrik Johannes
09/20/2022, 6:08 AMfrom(zipTree(specFiles.singleFile))
Jendrik Johannes
09/20/2022, 6:10 AMfrom(specFiles.elements.map { zipTree(it.first()) })
Vampire
09/20/2022, 10:24 AMprocessResources
to also get eventual transformations, or the source of you want it.
Actually, iirc the java-library
plugin should already publish such a variant that you can directly use in consumer
. Make sure it is applied and have a look at :producer:outgoingVariants
output.Sid B
09/20/2022, 6:02 PMresources
and that is exactly what I needed.