1

The external jar exists. However, gradle cannot get it even though the path is right. How should it be resolved?

project build.gradle

buildscript{
    repositories {
        mavenLocal()
        mavenCentral()
        flatDir {
            dirs "../libs"
        }
    }

    dependencies {
        classpath "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.6.2"
    }
}

module build.gradle

repositories {
    mavenLocal()
    mavenCentral()
    flatDir {
        dirs "../libs"
    }
}

folder structure

X:/Dev/IntelliJProjects/libs //all flatDir libs go here
X:/Dev/IntelliJProjects/my-project/my-project--core

when i run gradlew clean publishtomavenlocal

Could not resolve all files for configuration ':my-project--core:compileClasspath'. Could not find external-project:myDependency:1.0.0. Searched in the following locations: - file:/X:/Dev/IntelliJProjects/libs/myDependency-1.0.0.jar

but when I go to the folder, the file is there.

naimdjon
  • 3,162
  • 1
  • 20
  • 41
theAnonymous
  • 1,701
  • 2
  • 28
  • 62
  • Could you add your project structure to the question? Is your `libs` folder actually outside of your project directory? – Lukas Körfer Dec 23 '20 at 13:06
  • added the folder structure. the thing is, why is gradle printing out it cant find the file at the location that i can manually find the file at? the file exists, it's there. i open windows explorer and it's there at the path gradle says it's not at. why cant gradle find it? – theAnonymous Mar 12 '21 at 17:09
  • 1
    Can you post the dir listing of the libs folder? – RaGe Mar 14 '21 at 13:23
  • Did you try adding it to the project's "dependencies {...}" section? I had a long discussion about this here: https://stackoverflow.com/a/61209978/410939 – Alex Mar 17 '21 at 12:11
  • 1
    @theAnonymous is the casing correct? Without the fully reproducible case it is not easy to say whats wrong. Post the log from gradle output and / or your build script. Also try -i and -d options in gradle, it prints out more stuff that could be useful. – naimdjon Mar 17 '21 at 21:24

0 Answers0