简体   繁体   English

sbt如何与IntelliJ集成?

[英]How does sbt integrate with IntelliJ?

Is there a definite doc somewhere that explains all the magic that happens behind the "Typesafe Activator" generation of "IntelliJ supported" project? 在某处是否有明确的文档来解释“ IntelliJ支持”项目的“ Typesafe Activator”生成背后发生的所有魔术?

The sbt build files look absolutely monstrous, and I have no idea what and where IntelliJ looks for. sbt生成文件看起来非常可怕,我不知道IntelliJ的内容和位置。

This is frustrating as working from two different PCs the scala seed project refers to different hard-coded paths. 当在两台不同的PC上使用scala种子项目引用不同的硬编码路径时,这令人沮丧。

Is there a good place to start? 有一个好的起点吗?

Last time I checked, the typesafe activator was using SBT as the underlying build tool. 上次检查时,类型安全激活器正在使用SBT作为基础构建工具。 When creating an intellij project it would thus use the sbt-idea plugin. 当创建一个intellij项目时,它将因此使用sbt-idea插件。 I guess a possible place to start would be that plugin's documentation. 我想一个可能的起点是该插件的文档。

However I think there is something else going on here. 但是我认为这里还有其他事情。 I think you have the activator installed on two different PCs and are trying to share the project between both PCs whether using version control or copying the folders. 我认为您已经在两台不同的PC上安装了激活器,并且正在尝试使用版本控制或复制文件夹在两台PC之间共享项目。

The sbt-idea plugin will indeed write some absolute path in ideas project files (most likely the absolute paths to the sbt managed libraries in the ivy cache of your home folder) since this is required for the intellij project to work. sbt-idea插件确实会在Ideas项目文件中写入一些绝对路径(很可能是主文件夹的常春藤缓存中sbt管理的库的绝对路径),因为这是intellij项目正常工作所必需的。

There should be no reason to "share" the idea project files, these should be considered computer specific and should not be checked into source control, or expected to work when copied from a random computer to another. 应该没有理由“共享”想法项目文件,这些文件应该被认为是特定于计算机的,不应被检查到源代码控制中,或者应该从随机计算机复制到另一台计算机时可以使用。 You are expected to regenerate them for each computer the project is worked on. 您应该为项目正在使用的每台计算机重新生成它们。

If that sounds like a burden, you may want to install the Intellij scala plugin. 如果这听起来很麻烦,则您可能需要安装Intellij scala插件。 Once installed, the sbt integration will allow you to import any sbt project even if you haven't generated the intellij support in the activator. 一旦安装,sbt集成将允许您导入任何sbt项目,即使您尚未在激活器中生成intellij支持。 Have a look at the features page , there is a video showing how to use the plugin. 看一下功能页面 ,有一个视频演示如何使用该插件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM