This repository, google-cloud-java, contains the Java client libraries for Google Cloud Platform services, as well as core components in sdk-platform-java.
The repository is a monorepo containing both generated and handwritten libraries, as well as core platform components and parent POMs.
sdk-platform-java/: Contains foundational components for building client libraries.- Note: This directory has its own
GEMINI.mdfile with detailed instructions specific to core development (GAPIC generator, GAX). - Includes
gapic-generator-java(the generator) andgax-java(Google API Extensions).
- Note: This directory has its own
google-auth-library-java/: The Google Auth Library for Java. This is a handwritten library used for authentication and credential management across all Google Cloud clients. It is a critical dependency for all client libraries.
google-cloud-pom-parent/: The top-level parent POM for all modules in the repository. It manages plugin versions and common configuration.google-cloud-jar-parent/: The parent POM for all client library JAR modules in the repository. It inherits fromgoogle-cloud-pom-parentand manages shared dependencies.gapic-libraries-bom/: The Bill of Materials (BOM) that manages versions of all client libraries to ensure compatibility when used together.java-shared-dependencies/(insidesdk-platform-java): Manages shared Maven dependencies for all Google Cloud Java client libraries to ensure consistency and avoid conflicts.
Directories starting with java- are client libraries for specific Google Cloud services.
- Generated Clients: The majority of these are automatically generated from service definitions (protos) using the GAPIC generator in
sdk-platform-java. - Handwritten & Split Repositories: Some major libraries are either entirely handwritten or are maintained as "split repos" (they have their own standalone repositories in the
googleapisGitHub organization but are also managed here). When working on these, be aware that changes may need to be synchronized with their respective split repos. Key examples include:- BigQuery: java-bigquery
- BigQuery Storage: java-bigquerystorage
- Spanner: java-spanner
- Spanner JDBC: java-spanner-jdbc
- Storage: java-storage
- Storage NIO: java-storage-nio
- Datastore: java-datastore
- Logging: java-logging
- Logging Logback: java-logging-logback
- Java 11+ (build targets Java 8 bytecode compatibility)
- Maven 3.0+
- Bazelisk (for integration tests in
sdk-platform-java)
- Build all modules:
mvn installfrom root. - Recommended for faster builds:
mvn install -T 1C -P quick-build. - Build specific module: Run
mvncommands within the module directory.
- Check:
mvn fmt:check - Format:
mvn fmt:format - Tip: Run in specific module to save time.
- Unit Tests:
mvn test. - Integration Tests: Module specific, may require emulators or live services.
- Core Components Testing: Components should have adequate unit and integration tests to ensure coverage and correctness.
- Minimize visibility scopes. Default to most restrictive access level.
- Use short names over fully qualified names.
- Avoid calling
@ObsoleteApior@Deprecatedmethods and classes. - Avoid unnecessary formatting changes to keep diffs clean.
- Use
mvnfor everything other than thetest/integrationfolder.
- Do not bump external dependency versions unless for CVE or critical bug fix.
- Avoid introducing new external dependencies if possible. Prefer Java standard library, then opt for existing dependencies.
- Commits: Conventional Commits
<type>(<scope>): <description>. - Pull Requests: Submitted via PR, require review. Pull latest from main and resolve conflicts.
- Testing: All new logic should be accompanied by tests.
For development on core components, refer to the following guides in sdk-platform-java:
- GAPIC Generator: sdk-platform-java/gapic-generator-java/DEVELOPMENT.md
- GAX: sdk-platform-java/gax-java/DEVELOPMENT.md
- Hermetic Build: sdk-platform-java/hermetic_build/DEVELOPMENT.md