Adding repositories to the buildscript

Hey all. I have recently started working on my (first) gradle plugin. Yay!
Anyway, I am hoping someone can point me in the right direction. I am attempting to add a maven repository and dependency to the buildscript during the Plugin apply method.

maven { name = "forge" url = "" }

project.getBuildscript().getRepositories(); // add project.getBuildscript().getDependencies().add("classpath", "net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT"); project.getPlugins().apply("net.minecraftforge.gradle.forge");

Is this something that can be done? And if so, I am unsure of how to implement the DefaultMavenArtifactRepository in the project.getBuildscript().getRepositories().add(…) function.

Source code can be found at:

You can do that only in an init script plugin (applied to an instance of Gradle). There are examples how to do it - just search.