The complexity of sbt can often feel like navigating a black box, especially when it comes to understanding and visualizing builds and tests. A recent Gradle webinar featuring long-time Scala veteran Iulian Dragos shed light on this very issue: the need for more enterprise-grade tools specifically designed for Scala and sbt. This post covers the key insights from that session, focusing on how enhanced observability and build caching with Develocity for sbt can significantly increase productivity for Scala developers.
How to get insights into your sbt builds and tests
Admit it—sbt is a black box for many Scala engineers. While powerful, sbt can present significant challenges when it comes to visualizing, diagnosing, and troubleshooting local and CI build and test failures. Simply put, we cannot think of a single observability or productivity tool for sbt available to professional development teams. Until now!
Develocity® is Gradle’s developer toolchain observability and productivity platform, designed to provide deep observability into build and test performance for Gradle, Maven, Bazel, sbt, npm (beta), and Python (beta).
Develocity integrates directly with sbt, extracting a wealth of information about every aspect of the build and test lifecycle. This means you can transform opaque build processes into transparent ones, get actionable insights to improve build times, reduce test flakiness, and enhance overall developer efficiency.
Key observability features for sbt
There are several key features of Develocity that bring unprecedented visibility to sbt builds and tests:
- Build Scan®: This feature provides task-level analytics for a single build execution, capturing data on dependency resolution, compilation steps, test execution, and more. Each build generates a shareable Build Scan, allowing for detailed post-mortem analysis.
- Console log with enhanced filtering: Develocity allows developers to go beyond simple grepping by filtering console output based on the specific tasks that produced it. This makes it significantly easier to pinpoint the source of warnings or errors.
- Timeline visualization: Understanding parallel execution in sbt is crucial for identifying bottlenecks. Develocity provides a visual timeline of task execution across threads, along with resource usage metrics (CPU, memory, disk, network, top processes) to correlate performance issues with system behavior. Detailed panels for each task reveal dependencies and delegates, offering a deeper understanding of sbt’s execution flow.
- Test result analysis: Develocity meticulously tracks test executions, providing summaries of passed, failed, and flaky tests. For flaky tests, it records retry attempts and historical trends, enabling developers to identify and address unstable parts of their codebase. Features like the “slowest tests” page help prioritize optimization efforts.
- Dashboards and trends: Moving beyond single build analysis, Develocity offers dashboards that aggregate data from numerous Build Scan reports over time. This allows teams to identify trends in build times, failure rates, and test flakiness, providing a high-level view of build health and areas for improvement.
The power of context: tags and custom values
To further enhance sbt observability, Develocity lets you use configurable tags (e.g., CI/local, operating system) and custom values (e.g., Scala version, Git commit) within Build Scan. This contextual information enables powerful filtering and searching, allowing developers to isolate issues based on specific environments or code states.
And finally…local and remote Build Cache for sbt
It’s rare for a Scala developer to not complain about how slow everything is. Scala compilation is slower than Java due to its advanced type system and language features, and this is where build caching and good observability into what sbt is doing can make the difference between keeping control over your build times vs being at the mercy of the build tool.
Beyond observability, Develocity also offers build acceleration capabilities, including a Build Cache for sbt that supports both local and remote caching. Develocity’s approach involves automated cache key calculation based on all inputs, and supports out-of-the-box caching of test and compilation results.
Build Cache for sbt allows developers coding locally and on CI to reuse unchanged compilation and tests outputs, significantly reducing build times by avoiding redundant work.
Scala developers finally have solid, enterprise-grade tooling for sbt productivity
Develocity presents a significant leap forward in providing Scala engineers with the observability and acceleration needed to truly understand and optimize their build processes. By demystifying the “black box” of sbt, it empowers teams to troubleshoot issues faster, improve build performance, and ultimately enhance developer productivity.
You can begin exploring the power of build observability today with Develocity’s free Build Scan feature available at scans.gradle.com.