我的项目中的一个库是添加对
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版本后缀?