简体   繁体   English

任何支持SBT的IDE?

[英]Any IDE supporting SBT?

is any IDE supporting SBT in a proper way (like Maven for example)? 是否有任何IDE以适当的方式支持SBT(例如Maven)? Because I've found a lot of tools that generate IDE-related configuration files but I haven't found any plugins that give any support of SBT interaction form within IDE. 因为我发现了许多生成与IDE相关的配置文件的工具,但是我没有找到任何能够在IDE中提供SBT交互形式支持的插件。

I want to make an IDE-agnostic project based on SBT, but also I want to be able to use full spectrum of features that IDE provide and not just use it as an editor and do all the other stuff from console. 我想基于SBT创建一个与IDE无关的项目,但我也希望能够使用IDE提供的全部功能,而不仅仅是将它用作编辑器并从控制台执行所有其他功能。

Does Intellij fit the bill ? Intellij是否符合要求? It has an SBT plugin (and a Scala plugin, obviously!) 它有一个SBT插件 (显然是一个Scala插件!)

I know this isn't exactly what you're looking for, but putting it here as a work-around for working with SBT in eclipse for whoever is interested. 我知道这不是你正在寻找的东西,而是把它作为一个解决方案,在eclipse中与SBT一起工作,对于任何有兴趣的人。

SBT generates eclipse config files, but after you import it, it works fine from within eclipse. SBT生成eclipse配置文件,但在导入之后,它可以在eclipse中正常工作。 You just need to set up the project for the first time outside of Eclipse, run SBT to resolve dependencies, generate eclipse structure using the eclipse sbt plugin and import into Eclipse. 您只需要在Eclipse之外第一次设置项目,运行SBT来解决依赖关系,使用eclipse sbt插件生成eclipse结构并导入Eclipse。 After that, you can run the code directly from Eclipse and it works fine. 之后,您可以直接从Eclipse运行代码,它可以正常工作。

Here're the steps in detail: 以下是详细步骤:

  1. Create the folder structure as follows: 创建文件夹结构如下: ScalaSBTProject

  2. Create a file called plugins.sbt in the project folder and add the following line to it: project文件夹中创建一个名为plugins.sbt的文件,并向其添加以下行:

     addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.1.0") 
  3. Create build.sbt in the root directory ie ScalaSBTProject with content similar to the following. 在根目录中创建build.sbt ,即ScalaSBTProject ,其内容类似于以下内容。 I'm using akka here, but add and remove libraries as you require: 我在这里使用akka,但是根据需要添加和删除库:

     name := "ScalaSBTProject" version := "1.0" scalaVersion := "2.10.0-RC2" resolvers += "Typesafe Repository" at "http://repo.typesafe.com/typesafe/releases/" libraryDependencies += "com.typesafe.akka" % "akka-cluster-experimental_2.10.0-RC2" % "2.1.0-RC2" 
  4. Open command prompt and run sbt in the directory ScalaSBTProject . 打开命令提示符并在sbt目录中运行ScalaSBTProject SBT will download and resolve whatever dependencies are required SBT将下载并解决所需的任何依赖项

  5. Run the command eclipse at the SBT command line. 在SBT命令行运行命令eclipse This will generate all the eclipse related project files 这将生成所有与eclipse相关的项目文件

  6. Import ScalaSBTProject into Eclipse using File->Import->Existing Project to workspace, and make sure you check Import into workspace 使用File->Import->Existing Project to ScalaSBTProject导入到Eclipse中,并确保选中Import into workspace

EDIT: Just as a Post-Script, you can quite easily create a batch file to take the name of the project and generate the eclipse compatible project, just a way to speed up the process. 编辑:就像后脚本一样,您可以非常轻松地创建一个批处理文件来获取项目的名称并生成兼容eclipse的项目,这只是加速该过程的一种方法。

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

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