-
Notifications
You must be signed in to change notification settings - Fork 1.1k
docs: add root-level development.md guide for scoped builds #13151
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+53
−0
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
2cbddd3
docs: add root-level development.md guide for scoped builds
blakeli0 6c577d5
Update development.md
blakeli0 39f4884
docs(development): align Section 2 code block with root-level -pl des…
blakeli0 46ad0be
docs(development.md): incorporate user edits for install commands and…
blakeli0 85e7751
docs: rename development.md to uppercase DEVELOPMENT.md
blakeli0 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| # Monorepo Scoped Development Guide | ||
|
|
||
| This document outlines development workflows and build strategies when working with specific client libraries or modules in the `google-cloud-java` monorepo. | ||
|
|
||
| --- | ||
|
|
||
| ## 1. Building a Specific Service (Fast Reactor Builds) | ||
|
|
||
| Instead of running a full build of the entire monorepo (which contains over 250+ modules and can take up to 30 minutes), you can target a single client library and let Maven automatically resolve and build all of its upstream dependencies using the `-pl` (project list) and `-am` (also make) flags. | ||
|
|
||
| Run the following command from the **root directory** of the repository: | ||
|
|
||
| ```bash | ||
| mvn install -pl java-spanner/google-cloud-spanner -am -P quick-build -DskipTests | ||
| ``` | ||
|
|
||
| ### Flag Explanations: | ||
| * **`-pl <module-path>`**: Targets only the specified project module. | ||
| * **`-am` (Also Make)**: Tells Maven to analyze the dependency tree and automatically compile any projects in the reactor that the target library depends on (e.g., `gax-java`, `google-auth-library-java`, `google-cloud-core`). | ||
|
blakeli0 marked this conversation as resolved.
|
||
| * **`-P quick-build`**: Bypasses unnecessary verification checks (like Checkstyle, Enforcer, Animal Sniffer) to significantly speed up local iteration. | ||
| * **`-DskipTests`**: Skips running unit and integration tests during compilation. | ||
|
|
||
| ### Edge Case: Imported BOMs in `<dependencyManagement>` | ||
|
|
||
| > [!WARNING] | ||
| > **Maven's `-am` (Also Make) reactor analysis does not automatically build imported BOMs.** | ||
|
|
||
| #### The Problem: | ||
| If a module (or one of its parent dependencies/dependency BOMs) imports another BOM from within the same monorepo via `<scope>import</scope>` in a `<dependencyManagement>` block, Maven **does not** recognize it as a concrete build dependency. | ||
| * *Example:* `google-cloud-bigtable-deps-bom` imports `google-cloud-monitoring-bom` via `<dependencyManagement>`. | ||
| * Running `mvn install -pl java-bigtable/google-cloud-bigtable -am` (or targeting the deps-bom directly) will **succeed without actually building the local version of `google-cloud-monitoring-bom`**. | ||
|
|
||
| #### The Solution (Targeted Build): | ||
| To resolve this without doing a full 30-minute monorepo build, you can explicitly list the imported BOMs in the `-pl` parameter: | ||
|
|
||
| ```bash | ||
| mvn install -pl java-monitoring/google-cloud-monitoring-bom,java-bigtable/google-cloud-bigtable-deps-bom,java-bigtable/google-cloud-bigtable -am -P quick-build -DskipTests | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ## 2. Building All Submodules under a Service Directory | ||
|
|
||
| Many services in this repository (e.g., `java-spanner`, `java-bigtable`) are structured as aggregator parents with multiple submodules (e.g., separate directories for client code, gRPC/Protobuf stubs, executors, and BOMs). | ||
|
|
||
| Once your upstream monorepo dependencies are installed in your local ~/.m2/repository cache, you can run standard Maven commands for a specific service from the repository root using the -pl flag: | ||
|
|
||
| ```bash | ||
| cd java-spanner | ||
| mvn compile | ||
| ``` | ||
|
|
||
| Your IDE such as Intellij should also be able to import all the upstream dependencies at this moment. You can perform the same operations as you would in a normal project such as running unit tests, debugging and so on. | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.