The Build Server Protocol (BSP) defines a standard way for the build tool such as sbt or Mill to interact with IDEs, letting you import your project, run compilation and other tasks, get error messages and progress updates directly in the IDE.
The Scala plugin for IntelliJ IDEA supports BSP as a client.
Before you start
Make sure you have completed the following steps:
Export your build to Bloop
Once the Bloop server is set up, you need to manually install the Bloop plugin inside your sbt project and export your build to Bloop.
Create a new or open an existing sbt project.
In the Project tool window, right-click the project directory, select .
In the New File dialog, enter plugins.sbt and click OK.
Open the plugins.sbt file in the editor and add the following command:addSbtPlugin("ch.epfl.scala" % "sbt-bloop" % "1.3.2")
Start the sbt shell or reload if it is already opened and enter the following command:bloopInstall
- Press Enter.
IntelliJ IDEA generates the appropriate configuration.
Close the project.
Import an sbt project from the bsp model
After you have exported your build to Bloop, you can import your project using bsp.
Click Import Project or Open on the welcome screen.
In the dialog that opens, select a directory that contains your sbt project.
On the page that opens, select the bsp option and click Next.
On the page that opens, in the Bloop executable field, make sure you have specified the absolute path to the location of the bloop executable.
- Click Finish.
IntelliJ IDEA imports the project. The bsp tool window displays the imported project and its dependencies.