SBT depend on specific snapshot version

前端 未结 3 1421
北恋
北恋 2021-02-07 14:29

I have artifactory with multiple snapshots versions such as artifact-0.1-20120831.103456-5.

My project depends on specific snapshot version. If I tell SBT

3条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-07 14:56

    Not the best solution but you may try to use conflict managers provided by Ivy (see apache docs). For example, 'latest-revision' is used by default and 'latest-compatible' manager should disallow any dependency conflicts.

    It doesn't look easy to set up though, someone on google sbt group posted the following rule:

    def addConflictManager(org: String, name: String, conflictManager: String) =
      ivyModule <<= (ivyModule, streams) map { (module, s) =>
        module.withModule(s.log) { (ivy, desc, _) =>
            import _root_.org.apache.ivy.{core, plugins}
            import core.module.id.ModuleId
            import plugins.matcher.PatternMatcher
    
            desc.addConflictManager(
              ModuleId.newInstance(org, name),
              ivy.getSettings.getMatcher(PatternMatcher.EXACT),
              ivy.getSettings.getConflictManager("latest-compatible"))
            module
        }
      }
    

提交回复
热议问题