gpt4 book ai didi

scala - SBT 中作用域库依赖项的特定语法?

转载 作者:行者123 更新时间:2023-12-04 01:10:32 26 4
gpt4 key购买 nike

http://www.scala-sbt.org/0.12.2/docs/Getting-Started/Library-Dependencies.html

If you want a dependency to show up in the classpath only for the Test configuration and not the Compile configuration, add % "test" like this:


libraryDependencies += "org.apache.derby" % "derby" % "10.4.1.3" % "test"

有人可以解释为什么我们使用这个符号吗?我的意思是最后的配置?

我们为什么不写这样的东西:
libraryDependencies in Test += "org.apache.derby" % "derby" % "10.4.1.3"

最佳答案

最后作为字符串的配置是 Ivy configuration更准确地描述为配置映射。 in Test虽然它确实涵盖了常见的用例,但并未涵盖所有用例。

Detailed-Topics/Dependency-Management 0.13 的页面也有关于它的更多信息。配置是 Ivy 特色。它们可以被认为是 Maven 范围的概括。

请注意,超出 Maven 范围的任何内容都需要 ivy.xml 形式的元数据。对于使用发布本地发布到本地存储库、发布到 Ivy 存储库或在发布前在本地构建中使用的元数据,情况就是如此。 pom.xml 形式的元数据,例如来自 Maven Central 的元数据,仅限于标准 Maven 范围。

关于scala - SBT 中作用域库依赖项的特定语法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17957198/

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