Dependencies modification in gradle.init script


Is there a possibility to modify script dependencies during the execution of gradle.init script. I have been able to get build script dependencies as a DefaultDependencyHandler object but when I try to get a particular dependency name or version I receive null or unspecified.

allprojects {

    afterEvaluate {

        def dependencyHandler = getDependencies()
        println "Dependency handler " + dependencyHandler

        def dependencies = dependencyHandler.gradleApi()
        println "Dependency name: " +
        println "Dependency version: " + dependencies.version
        println "Dependency group: " +

        def buildScript = project.getBuildscript()
        def deps = buildscript.getDependencies()
        println deps.gradleApi().getName()