Properly handle changing SNAPSHOT dependencies in Gradle with the Kotlin DSL

Originally posted on 2020-10-30

Sometimes you're working with bleeding edge code and you need to fetch dependencies that are changing at an unknown interval. In my case I'm working with DominoKit and it is undergoing pretty heavy development.

Today I noticed that my dependencies broke and I couldn't figure out why. It turns out that Gradle needs a little help to refresh changing dependencies so you don't just have to nuke your ~/.gradle directory.

I'm using the Kotlin DSL so the changes I needed to make were to add this block:

configurations.all {
    // Check for updates on changing dependencies at most every 10 minutes
    resolutionStrategy.cacheChangingModulesFor(10, TimeUnit.MINUTES)

And then change my snapshot dependencies from this:


To this:

api("org.dominokit:domino-ui:1.0-SNAPSHOT") { setChanging(true) }