Bazel Bzlmod and Dependency Management Training
Master Bzlmod dependency management in 2 days. Migrate from WORKSPACE, configure registries, and resolve complex dependency graphs.
Master Bazel's modern dependency management system with Bzlmod, the MODULE.bazel-based approach that replaces the legacy WORKSPACE file. This 2-day training covers the Bazel Central Registry, custom registries, version resolution algorithms, and practical migration strategies for existing WORKSPACE-based projects preparing for Bazel 7+ and the WORKSPACE removal in Bazel 9.
Training Details
| Duration | 2 days (16 hours) |
| Level | Intermediate |
| Delivery | In-person, Live online, Hybrid |
| Certification | N/A |
Who Is This For?
- Build engineers managing Bazel dependency infrastructure
- Platform engineers migrating from WORKSPACE to Bzlmod
- Software engineers working with external dependencies in Bazel
- Tech leads planning Bazel version upgrades (Bazel 7+)
- DevOps engineers maintaining internal Bazel registries
Learning Outcomes
After completing this training, participants will be able to:
- Write MODULE.bazel files with bazel_dep, module extensions, and use_repo declarations
- Navigate and publish modules to the Bazel Central Registry
- Set up and maintain custom Bazel registries for internal modules
- Migrate existing WORKSPACE files to Bzlmod incrementally
- Configure language-specific dependency management (Maven, pip, Go modules)
- Resolve version conflicts using overrides, compatibility_level, and yanked versions
Detailed Agenda
Day 1: Bzlmod Architecture and Registry System
Module 1: Bzlmod Concepts and Motivation
- WORKSPACE limitations: no transitive dependency management, load order sensitivity
- Bzlmod design goals: reproducible, diamond-safe dependency resolution
- MODULE.bazel syntax: module(), bazel_dep(), use_repo(), use_extension()
- Module versions, compatibility_level, and semantic versioning
- Bzlmod resolution algorithm: Minimal Version Selection (MVS)
- Hands-on: Create a MODULE.bazel from scratch, declare dependencies, explore the resolved dependency graph
Module 2: MODULE.bazel Syntax Deep Dive
- module() declaration: name, version, compatibility_level, repo_name
- bazel_dep() attributes: version, max_compatibility_level, dev_dependency
- Module extensions: use_extension(), tag classes, extension implementation
- use_repo() for importing repositories from extensions
- register_toolchains() and register_execution_platforms() in Bzlmod
- Hands-on: Write a MODULE.bazel with multiple dependencies, module extensions, and toolchain registrations
Module 3: Registry System and Bazel Central Registry
- Bazel Central Registry (BCR) structure: modules/, metadata, source.json, patches
- Browsing and searching the BCR at registry.bazel.build
- Custom registries: local path registries, Git-based registries, HTTP archive registries
- Registry selection priority: --registry flag, .bazelrc configuration
- Publishing to the BCR: module submission process, presubmit.yml
- Hands-on: Set up a local file-based registry, publish a module, configure registry priority
Module 4: WORKSPACE to Bzlmod Migration
- Bzlmod and WORKSPACE coexistence: --enable_workspace flag (Bazel 7 default off, Bazel 8 deprecated)
- WORKSPACE removal timeline: Bazel 9 removes WORKSPACE support entirely
- Migration strategy: incremental dependency migration, hybrid mode
- Identifying WORKSPACE deps: http_archive, git_repository, maven_install mappings
- Common migration pitfalls: macro expansion, bind() removal, managed_directories removal
- Hands-on: Migrate a real-world WORKSPACE file to MODULE.bazel incrementally, verify build equivalence
Day 2: Language-Specific Dependencies and Conflict Resolution
Module 5: Java and Maven Dependencies
- rules_jvm_external in Bzlmod: maven.install tag class
- Artifact pinning with maven_install.json lock file
- Excluding transitive dependencies, forcing versions
- Maven BOM support and dependency management
- Private Maven repository authentication
- Hands-on: Configure Maven dependencies via Bzlmod, pin versions, resolve transitive conflicts
Module 6: Python and pip Dependencies
- pip.parse in Bzlmod: requirements_lock, python_interpreter_target
- Per-platform requirements files with requirements_linux, requirements_darwin
- Wheel-only installs and sdist compilation requirements
- Hub repositories and pip_parse multi-version support
- Vendoring Python dependencies for hermetic builds
- Hands-on: Set up Python dependencies with pip.parse, handle platform-specific packages, create lock files
Module 7: Go and Gazelle Dependencies
- go_deps module extension: from_file with go.mod
- Gazelle integration with Bzlmod: gazelle:update, gazelle:resolve
- Go module proxy configuration and GOPROXY settings
- Replacing Go modules with local paths using overrides
- Managing Go toolchain versions with rules_go Bzlmod extension
- Hands-on: Configure Go dependencies from go.mod via Bzlmod, run Gazelle, manage Go toolchain versions
Module 8: Version Conflict Resolution and Capstone
- Minimal Version Selection (MVS) in practice: version upgrades and downgrades
- single_version_override: forcing a specific version globally
- multiple_version_override: allowing diamond dependencies with different versions
- archive_override, git_override, local_path_override for development
- Yanked versions: marking broken releases, --allow_yanked_versions
- bazel mod graph, bazel mod deps, bazel mod explain for dependency debugging
- Hands-on: Capstone project — migrate a multi-language project from WORKSPACE to Bzlmod, set up a custom registry for internal modules, resolve version conflicts, and verify hermetic builds
Prerequisites
- Bazel Fundamentals training or equivalent hands-on experience with Bazel
- Experience with WORKSPACE files and external dependency management
- Familiarity with at least one language-specific package manager (Maven, pip, Go modules)
- Understanding of semantic versioning and dependency resolution concepts
Delivery Formats
| Format | Description |
|---|---|
| In-Person | On-site at your company's location, hands-on with direct interaction |
| Live Online | Interactive virtual sessions with screen sharing and real-time labs |
| Hybrid | Combination of on-site and remote sessions, flexible scheduling |
All formats include hands-on labs, course materials, and post-training support.
Prerequisites
- Bazel Fundamentals or equivalent experience
- Experience writing BUILD files and managing dependencies
Ready to get started?
Request a training quote for your team — in-person, live-online, or hybrid.