question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Improve and make sbt's workflow more opinionated

See original GitHub issue

sbt is project independent. It allows users to suspend an existing sbt process in project A, change the directory to project B, fg the previous sbt process, reload, and have a working sbt for B.

This is a great advantage:

  • You only have one virtual machine running on your machine for different projects/repos.
  • You reuse the hot compiler across all those different projects/repos.
  • You reuse a hot sbt instance (things like reload and update make a difference in such a case).

In the past weeks, I’ve observed people’s common sbt workflows. The most common problem I’ve seen is people killing sbt instances because of <CTRL+C> not doing the right thing, or because they want to switch projects, or because they’ve done a change to an .sbt file.

This is a total productivity killer.

I think the status quo could be improved via three improvements to the build tool. They should be accompanied with a new page in the docs that recommend the new workflow, if we happen to have consensus.

Workflow improvements

  1. Job cancelling should never fail. The reasoning is that if it never fails, it can be enabled by default. Some of the times, jobs may be required to run in independent threads so that long-running interruptible tasks can be killed by shutting its thread down. This should:

    • Handle compile and similar tasks gracefully.
    • Handle background tasks and servers gracefully (there are some problems with akka-http servers).
  2. Add a cd command that allows users to change the project working directory automatically. This emulates the manual <CTRL+Z>, fg and reload.

    • Example 1: > cd /foo/bar/projects/b.
    • Example 2: > cd ../../projects/a.
    • The command autocompletes both absolute file paths and relative paths (based on the working directory).
  3. Watch project’s sbt files and do either of these two things:

    1. Reload sbt automatically.
    2. Warn user that the sbt files have changed, and that they should run reload.

    This is a little bit tricky to implement, but it’s worth it. As always, this feature can be disabled via a setting, but it’ll be enabled by default.

After all these changes have been done, a new doc page should be created with the title “The recommended sbt workflow” where we recommend such a workflow and say why. This new doc page will help beginners feel productive from the very start.

These suggestions are up to discussion, and I welcome more improvements along these lines.

sbt version: 1.x

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:5
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
laughedeliccommented, Oct 1, 2017

Job cancelling should never fail

A relevant issue: https://github.com/sbt/sbt/issues/3252

Warn user that the sbt files have changed, and that they should run reload.

There is a plugin for that: sbt-build-files-watcher (not sure it works with sbt-1.x). I’ve been using it for quite some time integrated with sbt-prompt to show the warning in the prompt.

0reactions
eed3si9ncommented, Oct 2, 2019

sbt 1.3.0 also enables Ctrl-C.

I am going to close this issue since it’s somewhat open-ended, but feel free to bring up specific topics in https://discuss.lightbend.com/c/tooling

Read more comments on GitHub >

github_iconTop Results From Across the Web

Meta: Improve sbt 1.0 documentation · Issue #3232 - GitHub
This is a meta ticket describing the problems I find in the sbt documentation and proposing some solutions to address them.
Read more >
The Southern Baptist Theological Seminary
Trained in Truth. Trusted for Truth. Southern Seminary (SBTS) offers gospel-centered, theologically-grounded training for ministry.
Read more >
Making it Work: Moving to On-Campus Studies
Join SBTS staff as we discuss how students "Make it Work" to relocate to Louisville for their studies. We will cover financial aid,...
Read more >
Center for Student Success | The Southern Baptist Theological ...
We are committed to helping you overcome challenges and make progress toward ... Receive writing assistance and improve your academic writing skills with ......
Read more >
The Southern Baptist Theological Seminary – Louisville ...
SBTS is happy to announce the upcoming renovation to the Library. In early 2022, work will begin on the main floor of the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found