Gradle versions tried:
6.6.1 & 6.8.3 (can’t update to 7.x for various reasons at the moment)
I’ve been trying to introduce dependency locking to our multi-project gradle. The basics seem to work fine but it felt a little tedious to manually update the lock files every time we change a dependency version. So I’ve been looking into automating some parts and my plan involves creating a task that doesn’t require passing a command line parameter. I can get into more details here if needed but I don’t think it’s very relevant at the moment.
The project structure is like this:
Common.Library Common.PolicyEvaluator
| |
| |
| |
|____Service.Controller____|
With a slight modification from the example from the documentation I added this to the root build.gradle:
subprojects {
dependencyLocking {
lockAllConfigurations()
}
task resolveAndLockAll {
gradle.startParameter.writeDependencyLocks = true
doLast {
configurations.findAll {
// Add any custom filtering on the configurations to be resolved
it.canBeResolved
}.each { it.resolve() }
}
}
....
For some reason, the task works for Common.PolicyEvaluator
and Service.Controller
but not Common.Library
. If I run gradle dependencies --write-locks
it works fine for all projects however.
I’ve been trying all sorts of modifications to Common.Library
build.gradle
, trim everything that’s unrelated but have not succeeded.
I’m uploading debug logs from Common.PolicyEvaluator
and Common.Library
. I don’t feel particularly comfortable sharing the full gradle files publicly but I can share relevant snippets if you have any suspicions around certain sections. Though arguably the debug file gives away quite a bit already :).
Oops, can’t upload files as a new user and the size limit won’t allow pasting here. I guess I’ll just mention that Common.PolicyEvaluator
has this extra log while the Common.Library
does not.
[LIFECYCLE] [org.gradle.internal.locking.DefaultDependencyLockingProvider] Persisted dependency lock state for project ‘:Common.PolicyEvaluator’
Appreciate any help/tips. Thanks.