如何在 IDEA 中完全清理、重新解析和重建 Scala sbt 管理的项目? [英] How to fully clean, re-resolve and rebuild a Scala sbt-managed project in IDEA?

查看:18
本文介绍了如何在 IDEA 中完全清理、重新解析和重建 Scala sbt 管理的项目?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

TL;DR:如何在 SBT 文件更改时完全协调 IntelliJ 中的所有依赖项

TL;DR: How can I fully reconcile all dependencies in IntelliJ when SBT file changes

我在 IntelliJ 中有一个 SBT 项目设置.在大多数情况下,if 就像一个魅力,但改变依赖和编译器的版本对我来说是相当痛苦的.

I have a SBT project setup in IntelliJ. For the most part if works like a charm, but it is quite a pain for me, to change the version of the dependencies and compilers.

我希望做的是更新我的 SBT 文件,然后在 IntelliJ 中单击 clean project 之类的内容,以便它是最新的.

What I hope to do, is to update my SBT file, and click something like clean project in IntelliJ, so it gets up to date.

我发现的最好的菜单项是重建项目.它读取新的依赖项,但保留旧的依赖项,因此外部库包含多个版本的 Scala 运行时和 3rd 方库.

The best menu item I have found is Rebuild project. It reads new dependencies, but keeps the old ones around, so External Libraries contains multiple versions of the Scala runtime and 3rd party libraries.

为了解决这个问题,我可以关闭 IntelliJ 并删除 .idea/libraries 中的所有文件.当我重新启动 IntelliJ 时,它将重新解决依赖关系.它有效,但手动删除元数据文件表明我做错了.

To get around this I can close IntelliJ and delete all files in .idea/libraries. When I restart IntelliJ it will re-resolve the dependencies. It works, but manually deleting metadata files indicates that I am doing the wrong thing.

推荐答案

在 *.sbt 文件中进行更改后刷新 IntelliJ:

To refresh IntelliJ after changes made in *.sbt files:

  • 打开 SBT 项目窗格(菜单视图/工具窗口/SBT)
  • 右键单击您的 SBT 项目
  • 选择刷新外部项目

这篇关于如何在 IDEA 中完全清理、重新解析和重建 Scala sbt 管理的项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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