The lines:
compileOnlyDependencies.extendsFrom(configurations.getByName("compileOnly”))
and
configurations.getByName("compileOnly").extendsFrom(compileOnlyDependencies)
create a circular dependency and fails to compile. One or the other should be removed.