IntelliJ 14 - 创建/导入 Scala/SBT 项目

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/26767463/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-22 06:41:10  来源:igfitidea点击:

IntelliJ 14 - Create / Import a Scala / SBT project

scalaintellij-ideasbtintellij-14

提问by Pablo R. Mier

IntelliJ 14 supports (in theory) SBT / Scala projects through the Scala plugin, which is still available in the official repo. According to this post"Scala plugin project itself now uses SBT for build and dependency management". However I cannot find any way to create or import a SBT / Scala project with IntelliJ. There is also a lack of documentation explaining more about this new way of configuring the Scala Plugin.

IntelliJ 14 通过 Scala 插件支持(理论上)SBT / Scala 项目,该插件在官方存储库中仍然可用。根据这篇文章“Scala 插件项目本身现在使用 SBT 进行构建和依赖管理”。但是,我找不到任何使用 IntelliJ 创建或导入 SBT/Scala 项目的方法。也缺乏详细解释这种配置 Scala 插件的新方法的文档。

I have the Scala plugin activated in the IntelliJ Ultimate 14.0 (139.224). Any ideas?

我在 IntelliJ Ultimate 14.0 (139.224) 中激活了 Scala 插件。有任何想法吗?

回答by Eugene Zhulenev

  1. Install scala plugin. Settings -> Plugins -> Scala -> Install
  2. Open directory with sbt build: File -> Open Project -> select directory with build.sbt -> configure settings
  1. 安装 Scala 插件。 Settings -> Plugins -> Scala -> Install
  2. 使用 sbt build 打开目录: File -> Open Project -> select directory with build.sbt -> configure settings

That worked for me just a couple of minutes ago. It may be necessary to reset cache and restart: File -> Invalidate Caches / Restart.

几分钟前这对我有用。可能需要重置缓存并重新启动:File -> Invalidate Caches / Restart

回答by Pablo R. Mier

I've finally figured out the exact problem. IntelliJ loaded the default settings of the previous version, including the old version of the Scala plugin. The problem was fixed uninstalling the old Scala plugin and following the steps posted by Eugene Zhulenev

我终于弄清楚了确切的问题。IntelliJ 加载了以前版本的默认设置,包括旧版本的 Scala 插件。问题已解决,卸载旧的 Scala 插件并按照 Eugene Zhulenev 发布的步骤进行操作

回答by kklw

Make sure you have the scala plugin for intellij. Go file>new>'project from existing source', select your project to import. Go to build.sbt and there should be a prompt to import the packages. Sometimes, you can try to file>synchronise or file>'invalidate cache and restart'.

确保你有 intellij 的 scala 插件。转到 file>new>'project from existing source',选择要导入的项目。转到 build.sbt,应该会提示导入包。有时,您可以尝试文件>同步或文件>'使缓存无效并重新启动'。