Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions java-bigtable/AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Java Bigtable Development Guidelines

When developing or modifying code within the `java-bigtable` directory, you must strictly follow these rules and perform these actions:

## 1. Source Control
- **Always** pull the latest changes from the `main` branch of `git@github.com:googleapis/google-cloud-java.git` before starting work.
- Checkout a new branch for your development instead of committing directly to `main`.

## 2. Unit Testing
- **Always write unit tests** for any new logic or modifications you implement.
- Follow **JUnit 5** conventions for writing and structuring tests (e.g., using `@Test`, `@BeforeEach`, etc., from `org.junit.jupiter.api`).
- Do not use JUnit 4 unless modifying an existing file that hasn't been migrated yet, but for new tests default to JUnit 5.

## 3. Clean Up Imports
- After writing or updating code, **always** check that imports are properly cleaned up.
- Avoid using fully qualified class names (e.g., `x.y.z.Class`) directly inline in the code.
- Ensure all required classes are imported in the header of the Java file.
- Remove any unused imports.

## 4. Code Formatting
- Automatically format the code using the `fmt-maven-plugin`.
- Before finalizing your changes, run the following command in the terminal from the `java-bigtable` directory or the relevant module directory:
```bash
mvn com.spotify.fmt:fmt-maven-plugin:format

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Using the short-hand command mvn fmt:format is more concise and standard, as the plugin is already configured in the project's Maven configuration.

Suggested change
mvn com.spotify.fmt:fmt-maven-plugin:format
mvn fmt:format

```
- **Troubleshooting**: If the formatting command fails, it is usually because of an incompatible JDK version. Ensure you are running it in an environment with the correct JDK version for the project (typically 17+, depending on the project configuration).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

To align with the repository's documentation guidelines, please add a section clarifying that mvn install is used for building snapshot artifacts to the local ~/.m2 repository.

Suggested change
- **Troubleshooting**: If the formatting command fails, it is usually because of an incompatible JDK version. Ensure you are running it in an environment with the correct JDK version for the project (typically 17+, depending on the project configuration).
- **Troubleshooting**: If the formatting command fails, it is usually because of an incompatible JDK version. Ensure you are running it in an environment with the correct JDK version for the project (typically 17+, depending on the project configuration).
## 5. Building and Installing
- Use mvn install to build snapshot artifacts to your local ~/.m2 repository.
References
  1. In documentation about the Java build process, clarify that mvn install is used for building snapshot artifacts to the local ~/.m2 repository.

Loading