# Buildscript classpath used in buildSrc plugin no longer working with latest 1.12 2014-03-01

**URL:** <https://discuss.gradle.org/t/buildscript-classpath-used-in-buildsrc-plugin-no-longer-working-with-latest-1-12-2014-03-01/7111>\
**Category:** Old Forum Archive\
**Created:** [March 3, 2014, 9:57am UTC](https://discuss.gradle.org/t/buildscript-classpath-used-in-buildsrc-plugin-no-longer-working-with-latest-1-12-2014-03-01/7111 "2014-03-03T09:57:00Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![steveb](https://avatars.discourse-cdn.com/v4/letter/s/ea666f/32.png) [@steveb](https://discuss.gradle.org/u/steveb)\
**Post date:** [March 3, 2014, 9:57am UTC](https://discuss.gradle.org/t/buildscript-classpath-used-in-buildsrc-plugin-no-longer-working-with-latest-1-12-2014-03-01/7111/1 "2014-03-03T09:57:00Z")

</div>

I just updated from 1.12 2014-02-05 to 2014-03-01 and got a problem with the buildscript classpath:

Using

```gradle
buildscript {
  dependencies {
    classpath files('Extern/gradle/ant.lib/p4java.jar')
  }
}

```

it seems that our plugins built in buildSrc/… can no longer find the classes defined in the buildscript classpath.

It worked in 1.12 2014-02-05.

Anyone knows how to fix this ?

---

<div class="post-metadata">

**Author:** ![luke\_daley](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/luke_daley/32/9890_2.png) [@luke\_daley](https://discuss.gradle.org/u/luke_daley)\
**Post date:** [March 3, 2014, 10:11am UTC](https://discuss.gradle.org/t/buildscript-classpath-used-in-buildsrc-plugin-no-longer-working-with-latest-1-12-2014-03-01/7111/2 "2014-03-03T10:11:00Z")

</div>

Can you explain this a little more?

It sounds like you have classes in buildSrc, that depend on classes that you add to the build’s build.gradle file. Is that it?

---

<div class="post-metadata">

**Author:** ![steveb](https://avatars.discourse-cdn.com/v4/letter/s/ea666f/32.png) [@steveb](https://discuss.gradle.org/u/steveb)\
**Post date:** [March 3, 2014, 11:55am UTC](https://discuss.gradle.org/t/buildscript-classpath-used-in-buildsrc-plugin-no-longer-working-with-latest-1-12-2014-03-01/7111/3 "2014-03-03T11:55:00Z")

</div>

I have a plugin that calls

```gradle
public void apply(Project project) {
   project.apply from: ...some script....

```

In this script I do

```gradle
buildscript {
  dependencies {
    classpath files('Extern/gradle/ant.lib/ivyp4.jar')
  }
}
repositories {
   add(new com.orga.ivy.plugins.p4resolver.P4Resolver()) {
      ...
   }
}

```

With the latest 1.12 it complains that it cannot find class com.orga.ivy.plugins.p4resolver.P4Resolver (which is in the jar defined before).

---

<div class="post-metadata">

**Author:** ![luke\_daley](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/luke_daley/32/9890_2.png) [@luke\_daley](https://discuss.gradle.org/u/luke_daley)\
**Post date:** [March 4, 2014, 6:42am UTC](https://discuss.gradle.org/t/buildscript-classpath-used-in-buildsrc-plugin-no-longer-working-with-latest-1-12-2014-03-01/7111/4 "2014-03-04T06:42:00Z")

</div>

I’m having trouble reproducing your problem.

Would you be able to supply a small project that I can run to experience the problem?

---

<div class="post-metadata">

**Author:** ![steveb](https://avatars.discourse-cdn.com/v4/letter/s/ea666f/32.png) [@steveb](https://discuss.gradle.org/u/steveb)\
**Post date:** [March 4, 2014, 10:04am UTC](https://discuss.gradle.org/t/buildscript-classpath-used-in-buildsrc-plugin-no-longer-working-with-latest-1-12-2014-03-01/7111/5 "2014-03-04T10:04:00Z")

</div>

While trying to get a small repo running I tracked down the problem to the classpath files(…).

Using an absolute path seems to work:

```gradle
buildscript {
  dependencies {
    classpath fileTree(dir: rootDir.absolutePath + '/Extern/gradle/ant.lib', includes:['ivyp4.jar','p4java.jar'])
    // worked for 1.7, but not with 1.12: classpath files('Extern/gradle/ant.lib/ivyp4.jar')
  }
}

```

---

<div class="post-metadata">

**Author:** ![luke\_daley](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/luke_daley/32/9890_2.png) [@luke\_daley](https://discuss.gradle.org/u/luke_daley)\
**Post date:** [March 4, 2014, 10:20pm UTC](https://discuss.gradle.org/t/buildscript-classpath-used-in-buildsrc-plugin-no-longer-working-with-latest-1-12-2014-03-01/7111/6 "2014-03-04T22:20:00Z")

</div>

Where is this ‘Extern’ directory in relation to the project root?

---

<div class="post-metadata">

**Author:** ![steveb](https://avatars.discourse-cdn.com/v4/letter/s/ea666f/32.png) [@steveb](https://discuss.gradle.org/u/steveb)\
**Post date:** [March 5, 2014, 8:31am UTC](https://discuss.gradle.org/t/buildscript-classpath-used-in-buildsrc-plugin-no-longer-working-with-latest-1-12-2014-03-01/7111/7 "2014-03-05T08:31:00Z")

</div>

Its like this

```gradle
buildSrc/...
Extern/...
Java/SubProject/...
build.gradle
settings.gradle

```

The buildSrc plugin is also applied it the rootProject. Applying it in the SubProject fails with files(…) .

Is there a way to define a repository only once and have all projects inherit this ? Currently it looks like every sub-project will instantiate its own resolver.

---

<div class="post-metadata">

**Author:** ![luke\_daley](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/luke_daley/32/9890_2.png) [@luke\_daley](https://discuss.gradle.org/u/luke_daley)\
**Post date:** [March 5, 2014, 8:33am UTC](https://discuss.gradle.org/t/buildscript-classpath-used-in-buildsrc-plugin-no-longer-working-with-latest-1-12-2014-03-01/7111/8 "2014-03-05T08:33:00Z")

</div>

I actually don’t understand why this ever worked, it shouldn’t have.

Can you please try:

```gradle
buildscript {
  dependencies {
    classpath rootProject.files('Extern/gradle/ant.lib/ivyp4.jar')
  }
}

```
