Migrating Airbnb’s JVM Monorepo to Bazel
Airbnb migrated its massive JVM monorepo from Gradle to Bazel, a process spanning 4.5 years. The primary reasons for the switch were Bazel's superior speed, reliability, and unified build infrastructure. Bazel's caching and remote execution significantly accelerated build and test times, improving developer productivity. The migration addressed Gradle's unreliability stemming from non-hermetic builds and resource contention. A proof-of-concept with Airbnb's Viaduct service demonstrated Bazel's effectiveness, leading to broader adoption. A crucial component was an automated build file generator to minimize developer effort and maintain co-existing build systems. This generator efficiently parsed source files, managed dependency cycles, and supported fine-grained build graphs. The migration also involved addressing challenges like multi-version third-party library support and ensuring deployment compatibility. Finally, rigorous testing, particularly startup and integration tests for services, validated the correctness of Bazel-built deployments. The overall result is a dramatically improved build system with increased developer satisfaction.