Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to stop Intellij from automatically running SBT

I imported an SBT project into into Intellij 13.1.

Whenever I change build.sbt, plugins.sbt, etc., Intellij reruns SBT.

Sometime that is nice, but when I do lot of stuff in the console, and after frequent changes, I have to wait because my IDE locks SBT from running (and SBT is sloooow).

Anyway, can I turn off the automatic SBT run in Intellij. I would prefer to do it myself, from the provided SBT window.

like image 303
Paul Draper Avatar asked Oct 04 '14 03:10

Paul Draper


People also ask

How can I stop sbt?

To leave sbt shell, type exit or use Ctrl+D (Unix) or Ctrl+Z (Windows).

How do I close an sbt shell in IntelliJ?

However Enter does not stop it and Ctrl-C kills the entire shell, reloading sbt.

What does sbt clean do?

clean – delete all generated sources, compiled artifacts, intermediate products, and generally all build-produced files. reload – reload the build, to take into account changes to the sbt plugin and its transitive dependencies.


2 Answers

I would leave the autoimport checkbox unchecked when importing a SBT project.

In this way, it doesn't refresh automatically, it must be done by hand.

In order to change it, after it has been imported, you can edit by hand the .idea/sbt.xml file:

<project version="4">   <component name="ScalaSbtSettings">     <option name="linkedExternalProjectsSettings">       <SbtProjectSettings>         <option name="externalProjectPath" value="$PROJECT_DIR$" />         <option name="jdk" value="1.7" />         <option name="resolveClassifiers" value="true" />         <option name="useAutoImport" value="true" />       </SbtProjectSettings>     </option>   </component> </project> 

and change the useAutoImport setting. If necessary, restart IDEA.

UPDATE: Also in the settings page, search for SBT, and there you can enable or disable auto-import of SBT files.

When doing heavy work on a .sbt file, I disable auto-import.

like image 178
david.perez Avatar answered Oct 02 '22 18:10

david.perez


IntelliJ 14.1 now allows you to adjust SBT settings after importing projects.

File > Settings > Build > Build Tools > SBT (Or click the settings button on the SBT projects panel.)

Uncheck "auto-import".

enter image description here

This is the user-friendly equivalent of david.perez's answer.

like image 28
Paul Draper Avatar answered Oct 02 '22 18:10

Paul Draper