gpt4 book ai didi

sbt - TeamCity 无法解析来自 Nexus 的测试工件,出现 "configuration not public"错误

转载 作者:行者123 更新时间:2023-12-04 22:07:19 26 4
gpt4 key购买 nike

这类似于 sbt gives "configuration not public" for depending on test in subproject但我们没有外部 Ivy 文件。我们有

lazy val core = "com.huawei.scalan" %% "core" % "0.1-SNAPSHOT" % "compile->compile;test->test" 

lazy val enterprise = Project(
id = "enterprise-edition",
base = file(".")
).configs(ItTest).settings(commonSettings: _*).
settings(libraryDependencies ++= Seq(core))

依赖项取 self 们的 Nexus 存储库,按照 http://www.scala-sbt.org/0.13/docs/Proxy-Repositories.html 中的描述设置.这适用于开发人员的构建,但在同一台机器上运行的 TeamCity 会产生错误:

[warn] :: com.huawei.scalan#core_2.10;0.1-SNAPSHOT: configuration not public in com.huawei.scalan#core_2.10;0.1-SNAPSHOT: 'test'. It was required from com.huawei.scalan#enterprise-edition_2.10;0.2-SNAPSHOT test

它肯定会访问正确的存储库,因为它可以毫无问题地检索compile 配置。 SBT 版本为 0.13.5。在写这道题的过程中我找到了一个workaround:write dependency as

lazy val core = "com.huawei.scalan" %% "core" % "0.1-SNAPSHOT"

...
settings(libraryDependencies ++= Seq(core, core % "test" classifier "tests"))

所以问题更多的是为什么以前的配置对 TeamCity 不起作用,而在使用 publishLocal确实起作用。

最佳答案

sbt issue似乎解释了它:如果同一版本已从公共(public) Maven 存储库中解析出来,这将是尝试获取测试依赖项的结果。

解决方法是对非最终版本使用 git SHA 版本控制或 SNAPSHOT。

关于sbt - TeamCity 无法解析来自 Nexus 的测试工件,出现 "configuration not public"错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26235997/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com