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

15,493

Solution 1

NOTE IntelliJ 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.

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

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

enter image description here

It does require a local installation of SBT.

Solution 2

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

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

enter image description here

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

enter image description here

Solution 3

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

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

Share:
15,493
Jacek Laskowski
Author by

Jacek Laskowski

I am an IT freelancer specializing in apache-spark, delta-lake, apache-kafka and kafka-streams (with scala and sbt). I offer consultancy, courses, workshops, mentoring and software development services. Contact me at [email protected] or DM me on twitter @jaceklaskowski. I'm best known by "The Internals Of" online books available free of charge at https://books.japila.pl/. I run Warsaw Data Engineering meetups.

Updated on July 29, 2022

Comments

  • Jacek Laskowski
    Jacek Laskowski almost 2 years

    I use IntelliJ IDEA 13.1 Community Edition with the Scala plugin 0.32.593.

    enter image description here

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

  • WarLord
    WarLord about 8 years
    Lets say I want to use the "run" command here. How do I specify the port number?
  • Nader Ghanbari
    Nader Ghanbari almost 8 years
    Did you try putting the command with the parameters in single quotes or backticks?
  • Big Rich
    Big Rich almost 8 years
    @nader-hadji-ghanbari, putting the SBT Task and its parameters in double quotes ("") was enough to get this working as a configuration, e.g. "test-only my.package.TestClassName" ;-D
  • Ameba Spugnosa
    Ameba Spugnosa about 7 years
    IntelliJ 2017.1.1 CE here, the method does not work as SBT is not found. Are you sure you had not sbt already installed system wide?
  • Jacek Laskowski
    Jacek Laskowski about 7 years
    I did install sbt locally as said in "It does require a local installation of SBT." (the last sentence). I think you could however use the built-in sbt in 2017.1.1. Haven't checked that out tough.