Adds a compileOnly configuration to a Java based gradle build.