I turned the gist into a plugin to simplify things. Plugin here, sample usage here
apply plugin: 'com.lazan.java-monkey-patch' monkeyPatch { target = 'org.springframework:spring-context:4.3.9.RELEASE' }