【问题标题】:sbt lock SNAPSHOT dependencysbt lock SNAPSHOT 依赖
【发布时间】:2020-01-04 00:32:59
【问题描述】:

我使用 sbt-lock 插件并想下载最新的快照,包括 -SNAPSHOT 版本。当我写在我的 build.sbt 中时

libraryDependencies += "org.consensusresearch" %% "scorex-basics" % "1.2.+"

并运行 sbt relock 它只找到 1.2.6 版本,而 1.2.7-SNAPSHOT 版本可用。如何设置sbt加载1.2.7-SNAPSHOT版本?

【问题讨论】:

    标签: scala sbt


    【解决方案1】:

    这是一个众所周知的问题,很多人都在苦苦挣扎example

    我发现唯一有效的解决方法(即在尝试 clean、cleanAll、update 等但没有运气之后)是使用 build.sbt 中的自定义任务定位和删除 Ivy 缓存中的依赖项,然后重建

    lazy val nukeIvy = taskKey[Unit]("Execute rm -rf ~/ivy2/cache script")
    nukeIvy := {
      val s: TaskStreams = streams.value
      val shell: Seq[String] =
        if (sys.props("os.name").contains("Windows")) Seq("cmd", "/c")
        else Seq("bash", "-c")
      val removeIvy: Seq[String]          = shell :+ "rm -rf ~/.ivy2/cache/com.explori"
      val removeCommonCodecs: Seq[String] = shell :+ "rm -rf ~/.ivy2/cache/commons-codec"
      s.log.info("nuking ivy cache...")
      if ((removeIvy !) == 0 && (removeCommonCodecs !) == 0) {
        s.log.success("remove com.explori from ivy cache successful!")
      } else {
        throw new IllegalStateException("cleanIvy failed!")
      }
    }
    

    【讨论】:

      猜你喜欢
      • 2012-01-01
      • 2014-08-15
      • 2015-07-18
      • 2011-11-25
      • 2012-01-03
      • 2013-12-08
      • 2014-07-26
      • 1970-01-01
      • 2013-06-29
      相关资源
      最近更新 更多