How to put SBT into offline mode with a command line setting

Scala SBT FAQ: How do I put SBT into offline mode so I can use it while working on an airplane, or any other location where I don't have a WiFi connection?

Use an SBT command like this to compile and run a project from your operating system command line:

$ sbt "set offline := true" run

I used this command a lot recently when I didn't have internet access, and I had to keep SBT from trying to reach out to the internet all the time.

From the SBT command prompt

If you work at the SBT command prompt, use this setting before entering your other clean/compile/run/etc commands:

> set offline := true

To reverse the setting, just change it to false instead of true:

> set offline := false

While I'm in the neighborhood of talking about changing SBT settings at the command prompt, here's how you change the SBT log level:

> set logLevel := Level.Debug

As you might guess there are other settings like Level.Debug, Level.Info, Level.Error, and the other one is either Level.Warn or Level.Warning (Sorry, I'm too lazy at the moment to look it up).

Add new comment

Anonymous format

  • Allowed HTML tags: <em> <strong> <cite> <code> <ul type> <ol start type> <li> <pre>
  • Lines and paragraphs break automatically.