Gradle failed to load dependency

I’m building “build.gradle” according to this document:

For some reason, it couldn’t load grgit jar. I tried many ways, none of them worked.

Here is the build.gradle:

plugins {
id ‘groovy’

repositories {


dependencies {
implementation gradleApi()
implementation localGroovy()
//implementation files(‘libs/grgit-core-3.0.0.jar’)
//implementation fileTree(dir: ‘libs’, include: [’.jar’])
//implementation fileTree(dir: ‘libs’, include: [’.jar’])
//compile group:‘org.ajoberstar.grgit’, name : ‘grgit-core’, version : ‘3.0.0-beta.1’
compile ‘org.ajoberstar.grgit:grgit-core:3.0.0’


sourceSets {
main {
groovy {
srcDirs = [‘buildSrc/src/main/groovy’]

Here is the error:
C:\work\MessageBrokerGradlePlugin>gradlew build
:buildSrc:compileJava NO-SOURCE
startup failed:
C:\work\MessageBrokerGradlePlugin\buildSrc\src\main\groovy\ca\cooperators\mb\tasks\CloneGitRepoTask.groovy: 10: unable to resolve class org.ajoberstar.grgit.Branch
@ line 10, column 1.
import org.ajoberstar.grgit.Branch

1 error

:buildSrc:compileGroovy FAILED

FAILURE: Build failed with an exception.

What went wrong:
Execution failed for task ‘:buildSrc:compileGroovy’.
Compilation failed; see the compiler error output for details.

Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

Total time: 4.463 secs

this has been fixed. please close it.

would you be so kind and tell me how you fixed it?