使IntelliJ IDEA了解SBT依赖关系 [英] Getting IntelliJ IDEA understand SBT dependencies

查看:96
本文介绍了使IntelliJ IDEA了解SBT依赖关系的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经安装了SBT和Scala,并且一切正常.

I have SBT and Scala installed and things work well.

现在我有一个IntellIJ IDEA项目,该项目可以正常运行,除了不理解下载到/Users/MyName/.ivy2/cache/中的依赖项.

Now I have an IntellIJ IDEA project, which works otherwise OK except that dependencies which are downloaded into /Users/MyName/.ivy2/cache/ are not understood.

我尝试将缓存路径设置为源文件夹:

I tried setting the cache path as a source folder:

但仍然无法解决问题

如您所见, org.eclipse 为红色,表示找不到.它必须在我在左侧显示的 .jar 文件中.

As you can see, org.eclipse is in red color meaning it can't find it. It must be inside that .jar file I showed on the left.

我只想使用SBT更新/下载依赖项,然后使用这些依赖项使编译在IntelliJ IDEA中工作.

I just want to update/download dependencies using SBT, and then get the compilation to work in IntelliJ IDEA with those dependencies.

推荐答案

使用 sbt-idea SBT插件.然后,您可以从sbt命令行运行"gen-idea",它将生成IDEA使用的元数据文件.这些文件包含SBT使用它们时jar的位置,以便IDEA像SBT一样知道依赖项在哪里.

Use the sbt-idea plugin for SBT. Then you can run "gen-idea" from the sbt command line and it will generate the metadata files used by IDEA. These files contain the locations of jars as SBT uses them so that IDEA will know where the dependencies are, just like SBT.

这篇关于使IntelliJ IDEA了解SBT依赖关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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