如何测试 sbt 解析器 [英] How to test sbt resolvers

查看:46
本文介绍了如何测试 sbt 解析器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的本地机器上,我有一个常春藤缓存,它通过处理多个项目而被填满.

On my local machine I have an ivy cache that has been filled by working on multiple projects.

X 是使用项目A 中的解析器Y 加载的.在项目 B 中使用了相同的库 X,解决这个库没有问题,因为它在我的本地缓存中.

A library X is loaded using resolver Y in project A. This same library X is used in project B, no problems resolving this library because it's in my local cache.

当我的一位同事加载项目 B 时,他得到的错误是库 X 无法解析.问题:解析器 Y 丢失.

When one of my colleagues loads project B he get's the error that library X could not be resolved. The problem: resolver Y is missing.

如何测试我的 sbt 项目是否有一套完整的解析器来解析所有依赖项而不删除我的常春藤缓存?

推荐答案

此命令允许您查找当前项目是否缺少任何更新.请注意,这不会发现您的插件缺少任何解析器.

This command allows you to find if you are missing any updates for the current project. Note that this will not discover any missing resolvers for your plugins.

commands += Command.command("testUpdate") { state =>
  val base = baseDirectory.value
  val newState = Project
    .extract(state)
    .append(Seq(ivyPaths := new IvyPaths(base, Some(base / "tmp-cache"))), state)
  val (s, _) = Project
    .extract(newState)
    .runTask(update, newState)
  s
}

之后可以通过删除目录来扩展它.

It could be expanded by removing the directory afterwards.

这篇关于如何测试 sbt 解析器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆