# Gradle-git - external library trouble!

**URL:** <https://discuss.gradle.org/t/gradle-git-external-library-trouble/5763>\
**Category:** Old Forum Archive\
**Created:** [April 18, 2014, 8:55pm UTC](https://discuss.gradle.org/t/gradle-git-external-library-trouble/5763 "2014-04-18T20:55:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Marek\_Counts](https://avatars.discourse-cdn.com/v4/letter/m/8797f3/32.png) [@Marek\_Counts](https://discuss.gradle.org/u/Marek_Counts)\
**Post date:** [April 18, 2014, 8:55pm UTC](https://discuss.gradle.org/t/gradle-git-external-library-trouble/5763/1 "2014-04-18T20:55:00Z")

</div>

I’m super new to gradle (basically what I have been able to read today)… and thus I’m sorry if I’m missing something really stupid.

I want to use the project gradle-git from ajoberstar, and wrote this build script.

```gradle
buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'org.ajoberstar:gradle-git:0.8.0'
    }
}

```

now. if i go to the directory and do a

```gradle
gradle dependencies

```

it downloads the project. but then does not list it as a dependancy in any of the categories. further more I can’t use it, below if my full code and if you try to run task cloneGitRepo it says it can’t find GitClone. Also the import is all underlined red as intelliJ tells me that cannot resolve symbol ‘ajoberstar’… but I did not know if this was a limitation of the IDE’s integration with gradle or not… but i don’t think it is.

```gradle
buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'org.ajoberstar:gradle-git:0.8.0'
    }
}
  apply plugin: 'java'
apply plugin: 'maven'
  group = 'org.ajoberstar'
description = 'Git plugins for Gradle'
version = '0.8.0'
  import org.ajoberstar.gradle.git.tasks.*
  task cloneGitRepo(type: GitClone) {
    def destination = file("destination_folder")
    uri = "your_git_repo_uri"
    destinationPath = destination
    bare = false
    enabled = !destination.exists() //to clone only once
}

```

I apologize as I’m probably just doing something really stupid or not understanding something simple. Thanks in advanced for any help!

---

<div class="post-metadata">

**Author:** ![quidryan](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/quidryan/32/73_2.png) [@quidryan](https://discuss.gradle.org/u/quidryan)\
**Post date:** [April 20, 2014, 4:21am UTC](https://discuss.gradle.org/t/gradle-git-external-library-trouble/5763/2 "2014-04-20T04:21:00Z")

</div>

The reason you don’t see the dependency is because it’s on the “classpath” configuration, which is not shown by the dependencies command. To show the buildscript classpath you have to do something like:

task show \<\< {

buildscript.configurations.classpath.each { println it }

}

Concerning the gradle-git commands, you’re referring to the docs for 0.6.0. That specific plugin experienced a major rewrite recently, and I don’t think the import line is correct anymore. If you change the version to 0.6.0, your script will work the way it is.

---

<div class="post-metadata">

**Author:** ![Marek\_Counts](https://avatars.discourse-cdn.com/v4/letter/m/8797f3/32.png) [@Marek\_Counts](https://discuss.gradle.org/u/Marek_Counts)\
**Post date:** [April 21, 2014, 12:46pm UTC](https://discuss.gradle.org/t/gradle-git-external-library-trouble/5763/3 "2014-04-21T12:46:00Z")

</div>

Thanks for the info on the Classpath, that helped. As for getting it to work I changed the version of the plugin to 0.6.0 and the script will still not run as the import still says that org.ajoberstar is not there… ☹ Can I not use the class in the same file I declared it in. but maybe in one of the sub build files?

---

<div class="post-metadata">

**Author:** ![Marek\_Counts](https://avatars.discourse-cdn.com/v4/letter/m/8797f3/32.png) [@Marek\_Counts](https://discuss.gradle.org/u/Marek_Counts)\
**Post date:** [April 21, 2014, 1:06pm UTC](https://discuss.gradle.org/t/gradle-git-external-library-trouble/5763/4 "2014-04-21T13:06:00Z")

</div>

Thanks, sorry, after a little working with it I was able to get it up and working. thanks for your help!
