Installation
Installing Copybara
Section titled “Installing Copybara”Copybara can be run in several ways: as a pre-built JAR, built from source, or via Docker.
Option 1: Download Pre-built JAR (Recommended)
Section titled “Option 1: Download Pre-built JAR (Recommended)”The easiest way to run Copybara is to download a pre-built release.
-
Download the latest release
Terminal window curl -fsSL -o copybara_deploy.jar \https://github.com/google/copybara/releases/download/v20251215/copybara_deploy.jar -
Verify Java is installed (Java 11+ required)
Terminal window java -version -
Run Copybara
Terminal window java -jar copybara_deploy.jar --help
Option 2: Build from Source
Section titled “Option 2: Build from Source”For the latest features or to contribute:
-
Clone the repository
Terminal window git clone https://github.com/google/copybara.gitcd copybara -
Build with Bazel
Terminal window bazel build //java/com/google/copybara:copybara_deploy.jar -
Run the built JAR
Terminal window java -jar bazel-bin/java/com/google/copybara/copybara_deploy.jar --help
Build Requirements
Section titled “Build Requirements”- Bazel: 6.0+ (or Bazelisk)
- Java: JDK 11+
- Git: For fetching dependencies
Option 3: Docker
Section titled “Option 3: Docker”Run Copybara in a container:
docker run -v $(pwd):/workspace \ gcr.io/copybara-public/copybara:latest \ copybara /workspace/copy.bara.sky workflow_nameCustom Docker Image
Section titled “Custom Docker Image”FROM eclipse-temurin:21-jdk
# Download CopybaraRUN curl -fsSL -o /opt/copybara_deploy.jar \ https://github.com/google/copybara/releases/download/v20251215/copybara_deploy.jar
# Set up entrypointENTRYPOINT ["java", "-jar", "/opt/copybara_deploy.jar"]Build and run:
docker build -t copybara .docker run -v $(pwd):/workspace copybara /workspace/copy.bara.skyVerify Installation
Section titled “Verify Installation”Create a simple config to test:
# Simple validation configcore.workflow( name = "test", origin = folder.origin(), destination = folder.destination(), authoring = authoring.overwrite("Test <test@example.com>"),)Validate the config:
java -jar copybara_deploy.jar validate test.bara.skyExpected output:
Configuration validated successfully.IDE Support
Section titled “IDE Support”IntelliJ IDEA
Section titled “IntelliJ IDEA”- Install the Starlark plugin
- Associate
.bara.skyfiles with Starlark
VS Code
Section titled “VS Code”- Install Starlark extension
- Add to settings:
{"files.associations": {"*.bara.sky": "starlark"}}