void updateDependencies(String groupId) {
def dependencies = project.configurations.collectMany { it.allDependencies }.findAll { it.group == groupId}
dependencies?.each { Dependency dep ->
def resolvedConfiguration = project.configurations
.detachedConfiguration(project.dependencies.create("${dep.group}:${dep.name}:latest.release")).getResolvedConfiguration()
def latestVersion = resolvedConfiguration.getFirstLevelModuleDependencies().find { it.getModuleName() == dep.name }?.getModuleVersion()
if(latestVersion && latestVersion != dep.version) {
project.ant.replaceregexp(file: project.file('build.gradle'), match: "${dep.group}:${dep.name}:${dep.version}",
replace: "${dep.group}:${dep.name}:${latestVersion}")
}
}
}