'How to configure gradle to download build script dependencies from local repository

I'm trying to declare the dependencies which will be used during execution of gradle Tasks in the buildScript. I want to make gradle to find these dependencies from local directory. So, I have configured the repository to refer to my local directory where I have kept all the downloaded jars. But when i execute the build, it says, It can't resolve all the dependencies. Below is the error.

Could not resolve all artifacts for configuration ':classpath'. Could not download proguard-gradle-7.1.0.jar (com.guardsquare:proguard-gradle:7.1.0) > Could not get resource 'https://plugins.gradle.org/m2/com/guardsquare/proguard-gradle/7.1.0/proguard-gradle-7.1.0.jar'. > Could not GET 'https://plugins.gradle.org/m2/com/guardsquare/proguard-gradle/7.1.0/proguard-gradle-7.1.0.jar'. > plugins.gradle.org Could not download proguard-base-7.1.0.jar (com.guardsquare:proguard-base:7.1.0) > Could not get resource 'https://plugins.gradle.org/m2/com/guardsquare/proguard-base/7.1.0/proguard-base-7.1.0.jar'. > Could not GET 'https://plugins.gradle.org/m2/com/guardsquare/proguard-base/7.1.0/proguard-base-7.1.0.jar'. > plugins.gradle.org Could not download proguard-core-7.1.0.jar (com.guardsquare:proguard-core:7.1.0) > Could not get resource 'https://plugins.gradle.org/m2/com/guardsquare/proguard-core/7.1.0/proguard-core-7.1.0.jar'. > Could not GET 'https://plugins.gradle.org/m2/com/guardsquare/proguard-core/7.1.0/proguard-core-7.1.0.jar'. > plugins.gradle.org Could not download kotlinx-metadata-jvm-0.1.0.jar (org.jetbrains.kotlinx:kotlinx-metadata-jvm:0.1.0) > Could not get resource 'https://plugins.gradle.org/m2/org/jetbrains/kotlinx/kotlinx-metadata-jvm/0.1.0/kotlinx-metadata-jvm-0.1.0.jar'. > Could not GET 'https://plugins.gradle.org/m2/org/jetbrains/kotlinx/kotlinx-metadata-jvm/0.1.0/kotlinx-metadata-jvm-0.1.0.jar'. > plugins.gradle.org Could not download kotlin-stdlib-1.3.72.jar (org.jetbrains.kotlin:kotlin-stdlib:1.3.72) > Could not get resource 'https://plugins.gradle.org/m2/org/jetbrains/kotlin/kotlin-stdlib/1.3.72/kotlin-stdlib-1.3.72.jar'. > Could not GET 'https://plugins.gradle.org/m2/org/jetbrains/kotlin/kotlin-stdlib/1.3.72/kotlin-stdlib-1.3.72.jar'. > plugins.gradle.org Could not download kotlin-stdlib-common-1.3.72.jar (org.jetbrains.kotlin:kotlin-stdlib-common:1.3.72) > Could not get resource 'https://plugins.gradle.org/m2/org/jetbrains/kotlin/kotlin-stdlib-common/1.3.72/kotlin-stdlib-common-1.3.72.jar'. > Could not GET 'https://plugins.gradle.org/m2/org/jetbrains/kotlin/kotlin-stdlib-common/1.3.72/kotlin-stdlib-common-1.3.72.jar'. > plugins.gradle.org

Can anyone please help me in resolving this?

    repositories {
        flatDir {
            dirs "/repo/common/java/libs/engine",
                    "/repo/common/java/libs/build"
        }
        //mavenCentral()
    }
    dependencies {
        classpath 'com.guardsquare:proguard-gradle:7.1.0'
        classpath 'com.guardsquare:proguard-base:7.1.0'
        classpath 'com.guardsquare:proguard-core:7.1.0'
        classpath 'org.jetbrains.kotlinx:kotlinx-metadata-jvm:0.1.0'
        classpath 'org.jetbrains.kotlin:kotlin-stdlib:1.3.72'
        classpath 'org.jetbrains.kotlin:kotlin-stdlib-common:1.3.72'
    }
} ```




Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source