How to run sbt task on make project in IntelliJ IDEA?

帅比萌擦擦* 提交于 2020-02-03 10:19:02

问题


I'm working on a scalajs project. My workflow is: make code changes, make project in IntelliJ, go to sbt and run fastOptJS task to produce js file, go to browser and test. I would like to remove the step of manually running fastOptJS task in sbt and make that happen automatically when I make project in IDEA. Is there any way to do that?

UPD: It would be also nice to keep sbt running between fastOptJS calls, cause it takes time for sbt to start.


回答1:


You can simply start the JavaScript compilation with the sbt watch mode.

Select Run | Edit configurations... and add a new SBT Task by pressing the green plus. In the field "Tasks:" define ~fastOptJS and then run the new configuration.

It will compile again whenever you have changed something.




回答2:


This should be the workaround for your propose, instead of use "Make Project ( Ctrl + F9 )", you can create a run in IDEA and configure an external tool as the image shown, where you can run the fastOptJS task in sbt.



来源:https://stackoverflow.com/questions/39245849/how-to-run-sbt-task-on-make-project-in-intellij-idea

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!