Why is Gradle retrieving a snapshot version of JUnit?

I’ve got

testCompile 'junit:junit:4.+'

in my build.gradle, and I expected it to resolve to junit 4.11, but instead it seems to be giving me 4.12-SNAPSHOT. Is this Gradle’s fault or JUnit’s? And is there a way to fix it, apart from hard-coding 4.11? The docs say Gradle resolves to a “static version”, but it’s not clear what that means.

This means that one of your declared repositories contains ‘junit-4.12-SNAPSHOT’, and the ‘4.+’ selector matches this in preference, since it is higher than ‘4.11’. Unfortunately there’s not currently any way (with a Maven repository) to provide a selector that requests the “highest 4.x version that is not a SNAPSHOT”.