I need to collect all the dependencies required by a project into a directory. How can that be done with Gradle 7?
This question came up before for older versions of Gradle where the solution is to use:
task copyToLib(type: Copy) {
into "$buildDir/output/lib"
from configurations.runtime
}
I’ve been using an adapted version of that for years using runtimeOnly
:
task copyToLib(type: Copy) {
into "$buildDir/output/lib"
from configurations.runtimeOnly
}
Now after upgrading to Gradle 7.4.2 from Gradle 6.X, I get this error:
> Resolving dependency configuration 'runtimeOnly' is not allowed as it is defined as 'canBeResolved=false'.
Instead, a resolvable ('canBeResolved=true') dependency configuration that extends 'runtimeOnly' should be resolved.
There’s actually a hint on how to solve this, but I’m not sure how to create that resolvable configuration that extends runtimeOnly
. Does somebody know how to do that?