Describe your use-case which is not covered by existing documentation.
In a multi-project, a project foo — that is consumed by other projects — needs to shadow one or more its packages. And there's no need for the "regular" non shadowed "output".
One can write in a consuming project :
dependencies {
implementation(project(path = ":foo", configuration = "shadow"))
}
However, this is not ideal as it allows to mistakenly declare implementation(project(":foo")) thus providing unshadowed packages / dependencies.
I suggest documenting the following example to address this usage.
As a reminder in Gradle, on a java library, folk are used to api, implementation, runtimeOnly (and compileOnly configurations). These configurations are where dependencies are declared (they are declarable). But when consuming a project like project(":foo"), Gradle looks for consumable configurations, and there are apiElements (for compilation) and runtimeElements (for runtime) for java library project.
So I suggest to document the tuning of these consumable configurations, to only have one declaration of the project without thinking about exposed configurations.
Consuming projects :
dependencies {
implementation(project(":foo"))
}
configurations {
named("apiElements") {
outgoing.artifacts.clear()
outgoing.artifact(tasks.shadowJar))
exclude(group = "org.eclipse.jetty")
}
named("runtimeElements") {
outgoing.artifacts.clear()
outgoing.artifact(tasks.shadowJar)
exclude(group = "org.eclipse.jetty")
}
}
Reference any relevant documentation, other materials or issues/pull requests that can be used for inspiration.
https://gradleup.com/shadow/multi-project/
Are you interested in contributing to the documentation?
I can do this part of the documentation.
Describe your use-case which is not covered by existing documentation.
In a multi-project, a project
foo— that is consumed by other projects — needs to shadow one or more its packages. And there's no need for the "regular" non shadowed "output".One can write in a consuming project :
However, this is not ideal as it allows to mistakenly declare
implementation(project(":foo"))thus providing unshadowed packages / dependencies.I suggest documenting the following example to address this usage.
So I suggest to document the tuning of these consumable configurations, to only have one declaration of the project without thinking about exposed configurations.
Consuming projects :
Reference any relevant documentation, other materials or issues/pull requests that can be used for inspiration.
https://gradleup.com/shadow/multi-project/
Are you interested in contributing to the documentation?
I can do this part of the documentation.