0

I am having issues with grgit plugin for gradle.

This is what I have in my build.gradle file:

plugins {
    id "org.ajoberstar.grgit" version "3.0.0-beta.1"
    id 'java-gradle-plugin'
}

apply from: 'path/to/my/otherFile.gradle

Now in my otherFile.gradle I would like to use Grgit like so:

import org.ajoberstar.grgit.Grgit

task cloneSomeRepo {
 doLast {
    def grgit = Grgit.clone(dir: "$buildDir/my-repo", uri:          "https://mygitserver.com/repo/gitrepo.git")
    println grgit.describe()
  }
} 

And in this file I am getting an error saying:

Could not get unknown property 'Grgit' for root project 'test' of type org.gradle.api.Project.

I am new to gradle, and I might not have understood how this should work, and any help Is very appreciated!

Loshmeey
  • 341
  • 1
  • 5
  • 18
  • I'm not seeing anything obvious wrong with your code. Have you tried putting the same code directly in your `build.gradle` instead of in `otherfile.gradle`? There could be some issue with how it works in an `apply from`. – ajoberstar Aug 12 '18 at 00:28
  • Actually, if I use it straight from the build.gradle all is good, just the actual clone operation can take some time, but that is not a real issue. I am pretty sure there is something wrong with the way that I am applying the other .gradle files into my build, since the import does not recognise any of the plugin classes that I'd like to use. – Loshmeey Aug 13 '18 at 07:05
  • I know there are some things that don't work in `apply from` scripts, not sure if imports are one of them (I wouldn't have thought so). – ajoberstar Aug 14 '18 at 02:57

0 Answers0