scala 如何从 IntelliJ IDEA CE 中执行 SBT 插件的任务?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/22121939/
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:05:45  来源:igfitidea点击:

How to execute SBT plugin's tasks from within IntelliJ IDEA CE?

scalaintellij-ideasbt

提问by Jacek Laskowski

I use IntelliJ IDEA 13.1 Community Editionwith the Scala plugin 0.32.593.

我使用IntelliJ IDEA 13.1 社区版和 Scala 插件0.32.593

enter image description here

在此处输入图片说明

What's the recommended way to execute a SBT plugin's tasks, say dependencyUpdatesfrom sbt-updates?

执行 SBT 插件任务的推荐方法是什么,比如dependencyUpdatessbt-updates

采纳答案by Jacek Laskowski

NOTEIntelliJ IDEA and the Scala and sbt plugins have improved since and you may want to read How to run sbt-assembly tasks from within IntelliJ IDEA?instead.

注意IntelliJ IDEA 以及 Scala 和 sbt 插件已经改进,您可能想阅读如何从 IntelliJ IDEA 中运行 sbt-assembly 任务?反而。

I worked it around with the Embedded Terminal plugin that shipped with the version of IDEA.

我使用IDEA版本附带的嵌入式终端插件解决了这个问题。

Alt+F12(or Tools> Open Terminal) to open a terminal window and then sbt dependencyUpdatesinside.

Alt+ F12(或Tools> Open Terminal)打开终端窗口,然后sbt dependencyUpdates进入。

enter image description here

在此处输入图片说明

It does require a local installation of SBT.

它确实需要在本地安装 SBT。

回答by Nader Ghanbari

In version 15of IntelliJ IDEA, using Scala Plugin version 2.0, you can run SBTtasks by adding a run configuration.

15IntelliJ IDEA版本中,使用 Scala Plugin 版本2.0,您可以SBT通过添加运行配置来运行任务。

First add a new run configuration by clicking on Run -> Edit Configurations. Then click the +button to add a new configuration and choose SBT Taskform the list

首先点击 添加一个新的运行配置Run -> Edit Configurations。然后单击+按钮添加新配置并SBT Task从列表中选择

enter image description here

在此处输入图片说明

Now provide the list of tasks separated by space in Tasksinput box:

现在在Tasks输入框中提供以空格分隔的任务列表:

enter image description here

在此处输入图片说明

回答by Franti?ek Hartman

Unless there has been a recent change (in 13.1), SBT plugin doesn't support running sbt tasks.

除非最近有更改(在 13.1 中),否则 SBT 插件不支持运行 sbt 任务。

See comments here http://blog.jetbrains.com/scala/2013/11/18/built-in-sbt-support-in-intellij-idea-13/

请参阅此处的评论http://blog.jetbrains.com/scala/2013/11/18/built-in-sbt-support-in-intellij-idea-13/

回答by sarit

You will have to run these two commands to run SBT in the terminal:

您必须运行这两个命令才能在终端中运行 SBT:

SBT_OPTS="-Xms512M -Xmx1536M -Xss1M -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=256M"
java $SBT_OPTS -jar `<SBT inatall>`/bin/sbt-launch.jar "$@"