【发布时间】:2017-03-27 22:15:42
【问题描述】:
我项目中的一个库是添加对scala-continuations 的依赖项。由于这仅用于我未使用的库的功能,因此我想删除依赖项。这可以通过使用来完成:
libraryDependencies += "com.jsuereth" %% "scala-arm" % "1.4" exclude(
"org.scala-lang.plugins", "scala-continuations-library_2.11"
)
这可行,但我不喜欢 _2.11 部分。我可以使用
excludeAll(ExclusionRule(organization="org.scala-lang.plugins"))
目前不存在具有此组织名称的其他工件,但我觉得它很臭,因为这在未来可能会改变。
我可以使用字符串操作从scalaVersion 组成名称:
libraryDependencies += "com.jsuereth" %% "scala-arm" % "1.4" exclude(
"org.scala-lang.plugins", "scala-continuations-library_" + scalaVersion.value.split('.').dropRight(1).mkString(".")
)
是否有一些更短的方法来执行此操作 - 一些 SBT 函数或可能用于排除的通配符操作,或者至少确定所需的 Scala 版本后缀?
【问题讨论】:
标签: scala sbt dependency-management