How to override internal Gradle dependencies in buildSrc?

My plugin, placed in buildSrc uses a library which requires newer snakeyaml version than bundled in Gradle 1.6 (released in 2010!). I would like to override the version, but both 1.6 and 1.15 are put on the classpath and it fails (version 1.6 is earlier on the classpath).

I tried to use that promising hack:

//compile gradleApi()
compile files(gradleApi().resolve().findAll{ !'snakeyaml') })

but it seems that Gradle applies compile gradleApi() automatically.

Question. How can I override internal Gradle dependency in buildSrc?

This is effectively

You could do configurations.compile.dependencies.clear() at the start of the build script.