Vespa consists of approximately 1.7 million lines of code, split equally between Java and C++. Build times can be significant, especially for a full build including C++ components.
Build Requirements
For Java Modules
- Java: JDK 17 or later
- Maven: Version 3.8 or later
- Memory: At least 1GB RAM for Maven (set via
MAVEN_OPTS) - Platform: Any OS supporting Java and Maven
For C++ Modules
- Platform: AlmaLinux 8
- CMake: For C++ build configuration
- Compiler: GCC with C++17 support
- Development tools: Complete C++ toolchain
Building Java Modules
Quick Start
The fastest way to build Java modules:--threads 1C flag tells Maven to use one thread per CPU core, significantly speeding up the build.
Bootstrap Script
Thebootstrap.sh script initializes the build environment. It has several modes:
What Bootstrap Does
The bootstrap script performs these tasks:Set up Maven wrapper
Downloads and configures Maven wrapper (
mvnw) version 3.9.12, ensuring consistent Maven versions across environments.Build plugins first
Maven plugins must be built before the main reactor build, as Maven cannot resolve plugin references that are built in the same reactor.
Environment Variables
Customize the Maven build with these environment variables:| Variable | Default | Description |
|---|---|---|
VESPA_MAVEN_COMMAND | ./mvnw | Maven command to use |
VESPA_MAVEN_EXTRA_OPTS | (empty) | Additional Maven options |
VESPA_MAVEN_TARGET | install | Maven goal to execute |
MAVEN_OPTS | (empty) | JVM options for Maven (e.g., -Xmx1024m) |
Building Specific Modules
To build only specific modules:Clean Build
For a completely clean build:Building C++ Modules
C++ modules are built using CMake. This requires a complete AlmaLinux 8 development environment.Setup Development Environment
The recommended approach is using Docker:CMake Build Process
Configure CMake
-DCMAKE_BUILD_TYPE=Release- Build optimized binaries-DCMAKE_BUILD_TYPE=Debug- Build with debug symbols-DEXCLUDE_TESTS_FROM_ALL=ON- Don’t build tests by default
CMake Module Structure
Vespa uses custom CMake functions for defining targets:vespa_add_library
vespa_add_library
Defines a library target:Options:
STATIC- Static library (default is shared)OBJECT- Object libraryINTERFACE- Header-only libraryTEST- Test library (excluded fromalltarget)SOURCES- Source filesDEPENDS- Target and library dependenciesOUTPUT_NAME- Custom library name
vespa_add_executable
vespa_add_executable
Defines an executable target:Options:
TEST- Test executableSOURCES- Source files (required)DEPENDS- DependenciesOUTPUT_NAME- Custom executable name
vespa_generate_config
vespa_generate_config
Generates C++ code from This generates config classes from Vespa config definitions.
.def config files:Testing Shell Scripts
Vespa includes shell scripts tested with BATS.Setup BATS (macOS)
~/.zshrc or ~/.bashrc) to make it permanent.
Running Shell Tests
IntelliJ Integration
Shell tests can be run in IntelliJ IDEA with the BashSupport Pro plugin. EnsureBATS_PLUGIN_PATH is exported before launching the IDE.
Continuous Integration
Vespa uses Buildkite for continuous integration:- Build status: Monitor at factory.vespa.ai
- Badge:
- Releases: Made from master branch every morning CET, Monday-Thursday
Troubleshooting
OutOfMemoryError during Maven build
OutOfMemoryError during Maven build
Increase Maven heap size:You may need even more memory for a full build.
Plugin resolution failures
Plugin resolution failures
This usually means plugins weren’t built first. Run:Then retry your Maven build.
C++ build fails with missing dependencies
C++ build fails with missing dependencies
Ensure you’ve built the required Java modules first:C++ tests require additional Java artifacts.
ABI compatibility check failures
ABI compatibility check failures
If you’re modifying public APIs, you need to update the ABI spec:
- Read the error message for the exact command to run
- Usually involves running a Maven goal to update the spec
- Commit the updated spec file with your changes
Next Steps
Running Tests
Learn how to run and write tests
Code Map
Navigate the codebase structure
Development Overview
Return to development overview
CMake Guide
Detailed CMake documentation