简体   繁体   English

使用Scala IDE中的SBT

[英]Using SBT from Scala IDE

The path from SBT to Scala-IDE is well described in many places: 从SBT到Scala-IDE的路径在很多地方都有很好的描述:

  1. Start with an SBT project 从SBT项目开始
  2. Add the SBT plugin definition: addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.1.0-RC1") 添加SBT插件定义:addSbtPlugin(“com.typesafe.sbteclipse”%“sbteclipse-plugin”%“2.1.0-RC1”)
  3. Run the 'eclipse' command from within SBT 从SBT中运行'eclipse'命令
  4. Open Eclipse with an installed Scala-IDE add-on 使用已安装的Scala-IDE插件打开Eclipse
  5. Import the project 导入项目

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配置文件。

No, you cannot do this. 不,你不能这样做。 The way to do it is as you described. 如你所述,这样做的方法。 Then, whenever you make changes to build.sbt (eg, new jar dependency), rerun the eclipse command from sbt and refresh the project in Eclipse so that the newly generated files are reloaded. 然后,每当您对build.sbt进行更改(例如,新的jar依赖项)时,从sbt重新运行eclipse命令并在Eclipse中刷新项目,以便重新加载新生成的文件。

As a seasoned Eclipse user, I wondered the same thing. 作为一名经验丰富的Eclipse用户,我想知道同样的事情。 Amazed that no one seemed to be going that direction, I decided to roll my own project. 很惊讶没有人似乎朝着那个方向前进,我决定推出自己的项目。

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! 但请随意贡献!

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

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