Scala + gradle + repositories flatDir{} 给出 xsbti/CompileFailed 错误

Scala + gradle + repositories flatDir{} is giving xsbti/CompileFailed error

**gradle build:** is throwing  xsbti/CompileFailed error

Scala + gradle + flatDir 作为存储库抛出 xsbti 编译失败错误。 请看附图 Scala Gradle Compilation error

**build.gradle** 

我的构建 gradle 文件如下所示 Build.gradle file

**Note: with MavenCentral repository its working fine. Only for flatDir as repository its not working**

TLDR;使用 flatDir 时,您的构建缺少传递依赖项

flatDir 存储库不同于 Maven 或 ivy 存储库。它不支持元数据(例如传递依赖)。如果您想将 jar 存储在本地文件夹中,我建议使用 maven repository directory layout 并在 gradle 中配置为

repositories {
   maven {
      url uri('path/to/repo') 
   } 
} 

使用这种格式,您可以将 poms 存储在 jars 旁边(包括组、工件、版本和传递依赖信息)。查看this gist for a gradle task which can download the artifacts (jars and poms) from a Configuration到本地目录

参见 flatDir documentation

Note that this type of repository does not support any meta-data formats like Ivy XML or Maven POM files. Instead, Gradle will dynamically generate a module descriptor (without any dependency information) based on the presence of artifacts

当flatDir作为仓库编译scala时+gradle 在 gradle dependencies

中添加以下代码
zinc 'com.typesafe.zinc:zinc:x.x.x'
zinc 'org.scala-lang:scala-library:x.x.x'
zinc 'org.scala-lang:scala-compiler:x.x.x'
zinc 'com.typesafe.sbt:sbt-interface:x.x.x'
zinc 'com.typesafe.sbt:incremental-compiler:x.x.x'

编辑 - 更正了增量编译器的组名