# Gradle.properties are not available when applying external script in buildscript

**URL:** <https://discuss.gradle.org/t/gradle-properties-are-not-available-when-applying-external-script-in-buildscript/8678>\
**Category:** Help/Discuss\
**Created:** [April 7, 2015, 2:11pm UTC](https://discuss.gradle.org/t/gradle-properties-are-not-available-when-applying-external-script-in-buildscript/8678 "2015-04-07T14:11:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Levon\_Saldamli](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/levon_saldamli/32/708_2.png) [@Levon\_Saldamli](https://discuss.gradle.org/u/Levon_Saldamli)\
**Post date:** [April 7, 2015, 2:11pm UTC](https://discuss.gradle.org/t/gradle-properties-are-not-available-when-applying-external-script-in-buildscript/8678/1 "2015-04-07T14:11:39Z")

</div>

I tried this solution with an external script but I too get the error that my property is not defined:

buildscript.gradle:

```gradle
dependencies {
    classpath "com.company.plugins:some-plugin:${pluginVersion}"
}

```

build.gradle:

```gradle
buildscript { 
    apply from: "buildscript.gradle", to: buildscript
}

```

gradle.properties:

```gradle
pluginVersion=5.6M6-SNAPSHOT

```

When running:

```shell
> gradle tasks

FAILURE: Build failed with an exception.

* Where:
Script '/Users/levsa/tmp/foo/buildscript.gradle' line: 2

* What went wrong:
A problem occurred evaluating script.
> Could not find property 'pluginVersion' on org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler_Decorated@24d3e83f.

```

Continuing the discussion from [Inherit / inject buildscript dependencies into custom script within subproject](http://discuss.gradle.org/t/inherit-inject-buildscript-dependencies-into-custom-script-within-subproject/7175/9):

> [@Inherit / inject buildscript dependencies into custom script within subproject](https://discuss.gradle.org/t/inherit-inject-buildscript-dependencies-into-custom-script-within-subproject/7175/9):
>
> 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.

---

<div class="post-metadata">

**Author:** ![isobretatel](https://avatars.discourse-cdn.com/v4/letter/i/5daacb/32.png) [@isobretatel](https://discuss.gradle.org/u/isobretatel)\
**Post date:** [December 2, 2016, 2:48pm UTC](https://discuss.gradle.org/t/gradle-properties-are-not-available-when-applying-external-script-in-buildscript/8678/2 "2016-12-02T14:48:39Z")

</div>

The example above (from Peter) does not work.
