'Using git dependency (non gradle based project) in versionCatalogs using gradle

I am trying to depend on a specific git version of a scala library. This scala library is build using sbt (therefore it doesn't have build.gradle files in tree).

Is there a way to define a new module so I can refer to it in versionCatalogs?

I've tried the following:

  1. clone https://github.com/zio/zio-nio into deps/zio-nio
  2. checkout series/2.0 branch of zio-nio
  3. define following configuration

I created a demo project on github.com to better illustrate the approach I wanted to take.

settings.gradle

dependencyResolutionManagement {
versionCatalogs {
        libs {
            version('zio', '2.0.0-M6-2')
            alias('scala-library').to("org.scala-lang:scala-library:$scalaVersion")
            // This dependency is used by the application.
            alias('guava').to('com.google.guava:guava:30.1.1-jre')
            alias('zio').to('dev.zio' , "zio_$scalaVersion").versionRef('zio')
            alias('zio-nio').to("dev.zio:zio-nio_$scalaVersion:2.0")
    }
}

build.gradle

dependencies {
    //implementation(libs.zio.nio)
    //implementation project(':zio-nio')
    module('dev.zio:zio-nio_2.13.7:2.0') {
        implementation(libs.zio)
        implementation(libs.scala.library)
        implementation fileTree(dir: 'deps/zio-nio')
    }
}

experiments/build.gradle

dependencies {
    implementation(libs.zio)
    implementation(libs.zio.nio)
    implementation(libs.scala.library)
}

This produces following error

* What went wrong:
Execution failed for task ':experiments:compileScala'.
> Could not resolve all files for configuration ':experiments:compileClasspath'.
   > Could not find dev.zio:zio-nio_2.13:2.0.
     Searched in the following locations:
       - https://repo.maven.apache.org/maven2/dev/zio/zio-nio_2.13/2.0/zio-nio_2.13-2.0.pom
       - file:..something../deps/zio-nio_2.13-2.0.jar
       - file:..something../deps/zio-nio_2.13.jar
     Required by:
         project :experiments


Sources

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

Source: Stack Overflow

Solution Source