在 Scala IDE 中使用 SBT
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11345534/
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
Using SBT from Scala IDE
提问by Hyman
The path from SBT to Scala-IDE is well described in many places:
从 SBT 到 Scala-IDE 的路径在很多地方都有很好的描述:
- Start with an SBT project
- Add the SBT plugin definition: addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.1.0-RC1")
- Run the 'eclipse' command from within SBT
- Open Eclipse with an installed Scala-IDE add-on
- Import the project
- 从 SBT 项目开始
- 添加SBT插件定义: addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.1.0-RC1")
- 从 SBT 中运行“eclipse”命令
- 使用已安装的 Scala-IDE 插件打开 Eclipse
- 导入项目
What is the reverse for this? If I start a new project in Scala-IDE, can I just add a build.sbt file and somehow tell Eclipse to use this when running the application?
什么是相反的?如果我在 Scala-IDE 中启动一个新项目,是否可以只添加一个 build.sbt 文件并以某种方式告诉 Eclipse 在运行应用程序时使用它?
Apologies if this seems obvious to some, but I've recently moved from ItelliJ Idea to Scala-IDE and I'm not certain about setting up Scala-IDE to use SBT and my sbt config files.
抱歉,如果这对某些人来说似乎很明显,但我最近从 ItelliJ Idea 转移到 Scala-IDE,我不确定是否设置 Scala-IDE 以使用 SBT 和我的 sbt 配置文件。
采纳答案by Jean-Philippe Pellet
No, you cannot do this. The way to do it is as you described. Then, whenever you make changes to build.sbt (e.g., new jar dependency), rerun the eclipsecommand from sbt and refresh the project in Eclipse so that the newly generated files are reloaded.
不,你不能这样做。方法和你描述的一样。然后,无论何时对 build.sbt 进行更改(例如,新的 jar 依赖项),eclipse从 sbt重新运行命令并在 Eclipse 中刷新项目,以便重新加载新生成的文件。
回答by Ruud Diterwich
As a seasoned Eclipse user, I wondered the same thing. Amazed that no one seemed to be going that direction, I decided to roll my own project.
作为一个经验丰富的 Eclipse 用户,我想知道同样的事情。很惊讶似乎没有人朝那个方向发展,我决定推出自己的项目。
https://github.com/scalastuff/esbt
https://github.com/scalastuff/esbt
Install plugin, create or modify build.sbt and dependencies are fetched, project files updated.
安装插件,创建或修改 build.sbt 并获取依赖项,更新项目文件。
It works for me, I use it every day. But it's not perfect or finished, and I'm not putting in a lot of effort in it at the moment. But do feel free to contribute!
它对我有用,我每天都在使用它。但它并不完美或完成,我目前并没有投入太多精力。但请随时做出贡献!

