palantir/gradle-consistent-versions

1.11.2: --write-locks and verifyLocks can disagree

iamdanfox opened this issue · 2 comments

What happened?

On an internal project (phono), running verifyLocks can fail, but running ./gradlew --write-locks produces no changes.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':verifyLocks'.
> Found dependencies whose dependents changed:
  -com.palantir.l:l2-api-objects:2.0.0-rc23-13-gd3afa75c7 (1 constraints: 0211f104)
  +com.palantir.l:l2-api-objects:2.0.0-rc23-13-gd3afa75c7 (2 constraints: c224fcc5)
  -javax.ws.rs:javax.ws.rs-api:2.1 (54 constraints: 41feb569)
  +javax.ws.rs:javax.ws.rs-api:2.1 (55 constraints: 620ce889)

  Please run './gradlew --write-locks'.

This problem does not occur with 1.10.0.

What did you want to happen?

This is really bad, because users are presented with a recommended action but it doesn't help. --write-locks and verifyLocks should always agree.

Sadly @dansanduleac was unable to repro this

I think this was actually caused by broken metadata cache locally vs on circle, where a component was mistakenly cached as if it had no dependencies. I still don't know how the cache got into this corrupted state.

Once the user's metadata was cleared (~/.gradle/caches/modules-2/metadata-2.71/descriptors/), the resolution worked locally as expected, and we were able to write locks.