1

I wanted to use a local dependency (a jar file) relative to my root project directory in my main module as a buildscript classpath via dependencyResolutionManagement in settings.gradle.kts.

Here's my settings.gradle.kts file:

pluginManagement {
    repositories {
        google()
        mavenCentral()
    }
}

dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()
        maven { url = uri("https://jitpack.io") }
      
        flatDir { dirs = setOf(File("plugins")) }
    }
}

rootProject.name = "AndroidApp"
include(":main", ":base")

However, gradle is resolving the path as C:\Users\Name\.gradle\daemon\7.5\plugins

I have tried below and none of them works:

1. File(".").absolutePath // C:\Users\Name\.gradle\daemon\7.5\.
2. rootProject.path // :
3. rootProject.children.size // 0
You Qi
  • 8,353
  • 8
  • 50
  • 68

1 Answers1

0

nevermind. I have made two mistakes:

  1. I need to declare in the pluginManagement block instead.
  2. Although it's resolving to gradle path initially, but it will use the correct relative path while resolving in the main module.
You Qi
  • 8,353
  • 8
  • 50
  • 68