Buildscript classpath does not seem to work with local repository

the following works –

/** Points to the local repository structures used to hold external jars. */
def repositoryThirdParty = "file://$System.env.DEV_HOME/xxxx/third_party/java/"
repositories {
  def repoPattern = '[module]/v[revision]/[artifact](-[classifier])(-[revision]).[ext]'
  ivy {
    ivyPattern repositoryThirdParty + repoPattern
    artifactPattern repositoryThirdParty + repoPattern
  }
}
/** Defines dependencies for scripts. */
buildscript {
  repositories {
    mavenCentral()
  }
  dependencies {
    classpath 'org.gradle.api.plugins:gradle-gae-plugin:0.9'
  }
}
/** Defines current versions of external jars so all build.gradle use same versions. */
ext {
  jodaTime = ':joda-time:2.3'
}
/** Defines external jars that will be used by all build.gradle here to simplify dependencies. */
dependencies {
  // external jars required for compiling
  compile ext.jodaTime
  // external jars required for testing
  testCompile ':junit:4.11'
}

the following does not work as it cannot find the gae plugin under the buildscript depenedencies though the repositories are setup properly as they work fine for the compile dependencies –

/** Points to the local repository structures used to hold external jars. */
def repositoryThirdParty = "file://$System.env.DEV_HOME/xxxx/third_party/java/"
repositories {
  def repoPattern = '[module]/v[revision]/[artifact](-[classifier])(-[revision]).[ext]'
  ivy {
    ivyPattern repositoryThirdParty + repoPattern
    artifactPattern repositoryThirdParty + repoPattern
  }
}
/** Defines dependencies for scripts. */
buildscript {
  dependencies {
    classpath ':gradle-gae-plugin:0.9'
  }
}
/** Defines current versions of external jars so all build.gradle use same versions. */
ext {
  jodaTime = ':joda-time:2.3'
}
/** Defines external jars that will be used by all build.gradle here to simplify dependencies. */
dependencies {
  // external jars required for compiling
  compile ext.jodaTime
  // external jars required for testing
  testCompile ':junit:4.11'
}

The ‘buildscript’ block needs its own repository declaration.

thank you yes, it worked after doubling up all variables I had tried that earlier but i guess i was trying to use the same variables for both is there a way to use the same variables “repositoryThirdParty” or “repositoryPattern” for both blocks?

I think you can declare an extra property (‘ext.foo = “bar”’) within the ‘buildscript’ block and then reference it from outside (‘buildscript.foo’). It doesn’t work the other way around.

I tried but could not read it from the other block is there a way to call a method to set up the repositories so both can use the same code? or a way to define system properties on these repositories thanks in advance

Please show exactly what you tried (and please wrap all code in HTML code tags). The ‘buildscript’ block is very special (think of it as its own file), so the options are limited.