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:
- If testA is available all is good, gradle downloads both testA and testB
- If testA is not available I want gradle to ignore resolution failure for testA dependency and move ahead to download testB.
Perhaps a bit counter-intuitively, you can use
getResolvedConfiguration()in combination withgetLenientConfiguration()to retrieve a configuration that does not fail if some of the references are not resolvable.See documentation.