dependencies {
test "com.test:testA:1.0@jar"
test "com.test:testB:1.0@jar"
}
task('collectArtifacts', type: Copy) {
from project.configurations.test
into 'artifacts/'
}
Assuming the artifact testA is missing and testB is available
When I use ./gradlew collectArtifacts it obviously complains saying "> Could not find com.test:testA:1.0".
How can I ask gradle to:
Perhaps a bit counter-intuitively, you can use getResolvedConfiguration()
in combination with getLenientConfiguration()
to retrieve a configuration that does not fail if some of the references are not resolvable.
task('collectArtifacts', type: Copy) {
from project.configurations.test.resolvedConfiguration.lenientConfiguration.getFiles(Specs.satisfyAll())
into 'artifacts/'
}
See documentation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With