Hello! I’m stuck with a really weird issue, and I’d like to hear your opinion on this.
I’m using Gradle 4.7. I am typically editing the
build.gradle file from Intellij, while having the Gradle auto-import setting turned on. However, on a couple of occasions a strange error occurred, as if the Gradle remembers older version of the build file and stubbornly uses that one.
For example, say I’m editing a dependency in my
compile 'org.slf4j:slf4j-api:1.7.24'. To upgrade that to version
1.7.25 I press backspace to remove the
4 so and type in
5. The file now looks like
compile 'org.slf4j:slf4j-api:1.7.25'; however when I do
./gradlew clean build Gradle fails that it can’t download
Workaround is to add any characters, say, a meaningless comment - then Gradle uses the correct file and the gradle script works. If I remove the comment and revert the gradle file back to slf4j-api:1.7.25, then Gradle reverts back to using
slf4-api:1.7.2 and fails.
It looks to me as if Gradle ‘remembered’ the build.gradle file in a state when the dependency was slf4-api:1.7.2, but under a hash of the build.gradle file which reads slf4-api:1.7.25.
Since the error happens at random and is really hard to reproduce, I do not know whether I should open a bug report, therefore I’m asking on the forums first. Thanks!