Avatar ·

How to add a local .jar file as a dependency in build.gradle?

Hello everyone! I'm a beginner in Gradle and Java, and I have a problem that I haven't been able to solve for several hours.

I have a Java project that is built with Gradle. I need to use an external library that comes as a regular .jar file (it's not a Maven dependency, but a local file, e.g., my-custom-lib.jar). I placed this .jar in the libs folder inside my project.

Here's what my current build.gradle looks like:

plugins {
    id 'java'
}

repositories {
    mavenCentral()
}

dependencies {
    // Here I'm trying to add the local .jar
    implementation 'my-custom-lib:1.0'
}

But when I run gradle build, I get an error: Could not r