2

我已将 Vespa 添加到 sbt 项目中:

libraryDependencies += "com.yahoo.vespa" % "vespa-http-client" % "6.225.3"

这会导致以下模块解析失败:

[warn]  Detected merged artifact: [FAILED     ] com.yahoo.vespa#component;6.225.3!component.container-plugin:  (0ms).
[warn]  Detected merged artifact: [FAILED     ] com.yahoo.vespa#vespajlib;6.225.3!vespajlib.container-plugin:  (0ms).
[warn] ==== local: tried
[warn] ==== local: tried
[warn] ==== public: tried
[warn] ==== public: tried
[warn] ==== local-preloaded-ivy: tried
[warn]   https://repo1.maven.org/maven2/com/yahoo/vespa/component/6.225.3/component-6.225.3.container-plugin
[warn]   C:\Users\gary\.sbt\preloaded\com.yahoo.vespa\vespajlib\6.225.3\container-plugins\vespajlib.container-plugin
[warn] ==== local-preloaded-ivy: tried
[warn] ==== local-preloaded: tried
[warn]   C:\Users\gary\.sbt\preloaded\com.yahoo.vespa\component\6.225.3\container-plugins\component.container-plugin
[warn]   file:/C:/Users/gary/.sbt/preloaded/com/yahoo/vespa/vespajlib/6.225.3/vespajlib-6.225.3.container-plugin
[warn] ==== local-preloaded: tried
[warn]   file:/C:/Users/gary/.sbt/preloaded/com/yahoo/vespa/component/6.225.3/component-6.225.3.container-plugin

旧版本和最新的 sbt (1.1.1) 都失败了。

4

2 回答 2

2

SBT 默认使用工件的打包类型作为文件扩展名。component我们的工件(以及许多其他工件)的 pom.xml使用包装类型container-plugin,而实际的 jar 文件当然具有标准jar后缀。

因此,您需要使用这些工件的文件后缀手动配置 SBT。我不知道是否有一种方便的方法可以同时为一组依赖项执行此操作,因为我不是 SBT 专家。但是对于您收到此错误的每个工件,您可以尝试以下操作:

libraryDependencies += "com.yahoo.vespa" % "component" % "6.225.3" artifacts( Artifact("component", "", "jar"))

我在这个 SO 答案中找到了它,但我自己没有测试过。也许您可以在 SBT 参考手册中找到一些有用的信息,即使用依赖项与工件

于 2018-03-28T00:59:19.320 回答
1

下面是vespa-http-cient的依赖: https ://github.com/vespa-engine/vespa/blob/master/vespa-http-client/pom.xml 我对SBT不是很了解,可能你需要显式包含这些依赖项,或指定包含传递依赖项。

于 2018-03-27T15:35:09.663 回答