# Inherit / inject buildscript dependencies into custom script within subproject

**URL:** <https://discuss.gradle.org/t/inherit-inject-buildscript-dependencies-into-custom-script-within-subproject/7175>\
**Category:** Old Forum Archive\
**Created:** [June 25, 2012, 8:17am UTC](https://discuss.gradle.org/t/inherit-inject-buildscript-dependencies-into-custom-script-within-subproject/7175 "2012-06-25T08:17:00Z")\
**Posts on this page:** 1\
**Showing post:** 9

<div class="post-metadata">

**Author:** ![Peter\_Niederwieser](https://avatars.discourse-cdn.com/v4/letter/p/9f8e36/32.png) [@Peter\_Niederwieser](https://discuss.gradle.org/u/Peter_Niederwieser)\
**Post date:** [June 25, 2012, 9:41am UTC](https://discuss.gradle.org/t/inherit-inject-buildscript-dependencies-into-custom-script-within-subproject/7175/9 "2012-06-25T09:41:00Z")

</div>

Script plugins aren’t currently affected by the buildscript section of the build scripts they get applied to. (Actually, it’s questionable whether subproject build scripts should be affected by the buildscript sections of parent build scripts, even though that’s the way it currently is.) What you can do is to move the reusable parts of the buildscript section into its own script plugin:

gradle/buildscript.gradle:

```gradle
repositories {
    maven {
        // from gradle.properties
        url nexusDependencies
    }
}
dependencies {
    classpath "com.inxmail:gradle-nsis-plugin:0.0.1-SNAPSHOT"
}

```

You can then include this code in any buildscript section that requires it: client/gradle/distribution.gradle:

```gradle
buildscript {
  apply from: "$rootProject.projectDir/gradle/buildscript.gradle", to: buildscript
}

```

This might get revised at some point, but it’s too early to tell.

---

_[View the full topic](https://discuss.gradle.org/t/inherit-inject-buildscript-dependencies-into-custom-script-within-subproject/7175)._
