|
| 1 | +# Development Guide |
| 2 | + |
| 3 | +This guide outlines core essentials for developing in this project. |
| 4 | + |
| 5 | +## Table of Contents |
| 6 | +- [Setup and Configuration](#setup-and-configuration) |
| 7 | + - [IDE Setup](#ide-setup) |
| 8 | + - [Consuming SNAPSHOTS](#consuming-snapshots-from-maven-central) |
| 9 | +- [Development Workflow](#development-workflow) |
| 10 | + - [Testing and Verification](#testing-format-and-lint) |
| 11 | + - [Documentation](#documentation) |
| 12 | + - [Pull Request Process](#pull-request-workflow) |
| 13 | +- [Release Process](#the-release-workflow) |
| 14 | + - [CI Release](#ci-release-process) |
| 15 | + - [Local Release](#local-release-process) |
| 16 | + - [Troubleshooting](#troubleshooting) |
| 17 | + |
| 18 | +## Setup and Configuration |
| 19 | + |
| 20 | +### IDE Setup |
| 21 | + |
| 22 | +#### VSCode |
| 23 | + |
| 24 | +1. Install [Checkstyle For Java](https://marketplace.visualstudio.com/items?itemName=shengchen.vscode-checkstyle) |
| 25 | +2. Open workspace settings - settings.json (for example with Ctrl+Shift+P → Preferences: Workspace Settings (JSON)) and add: |
| 26 | + ```json |
| 27 | + "[java]": { |
| 28 | + "editor.defaultFormatter": "redhat.java", |
| 29 | + }, |
| 30 | + "java.format.settings.url": "development/format/eclipse-java-google-style.xml", |
| 31 | + "java.format.settings.profile": "GoogleStyle", |
| 32 | + "editor.formatOnSave": true, |
| 33 | + "java.checkstyle.configuration": "development/lint/google_checks.xml", |
| 34 | + "java.checkstyle.version": "1x.xx.x" |
| 35 | + ``` |
| 36 | + |
| 37 | +#### IntelliJ |
| 38 | + |
| 39 | +1. **Code Style** |
| 40 | + - Settings → `Editor → Code Style → Java` |
| 41 | + - Click gear → `Import Scheme → Eclipse XML Profile` |
| 42 | + - Select `development/format/eclipse-java-google-style.xml` |
| 43 | + |
| 44 | +2. **Checkstyle** |
| 45 | + - Install "CheckStyle-IDEA" plugin |
| 46 | + - Settings → `Tools → Checkstyle` |
| 47 | + - Click the built-in Google Style Check |
| 48 | + |
| 49 | +### Consuming SNAPSHOTS from Maven Central |
| 50 | + |
| 51 | +Configure your pom.xml with: |
| 52 | + |
| 53 | +```xml |
| 54 | +<repositories> |
| 55 | + <repository> |
| 56 | + <name>Central Portal Snapshots</name> |
| 57 | + <id>central-portal-snapshots</id> |
| 58 | + <url>https://central.sonatype.com/repository/maven-snapshots/</url> |
| 59 | + <releases> |
| 60 | + <enabled>false</enabled> |
| 61 | + </releases> |
| 62 | + <snapshots> |
| 63 | + <enabled>true</enabled> |
| 64 | + </snapshots> |
| 65 | + </repository> |
| 66 | +</repositories> |
| 67 | +``` |
| 68 | + |
| 69 | +## Development Workflow |
| 70 | + |
| 71 | +### Testing, Format and Lint |
| 72 | + |
| 73 | +Run Maven verification: |
| 74 | +```shell |
| 75 | +mvn clean verify |
| 76 | +``` |
| 77 | + |
| 78 | +### Documentation |
| 79 | + |
| 80 | +Generate Javadocs: |
| 81 | +```shell |
| 82 | +mvn javadoc:javadoc |
| 83 | +``` |
| 84 | + |
| 85 | +View documentation in your browser: |
| 86 | +```shell |
| 87 | +<browser> target/reports/apidocs/index.html |
| 88 | +``` |
| 89 | + |
| 90 | +### Pull Request Workflow |
| 91 | + |
| 92 | +When submitting a PR, CI will automatically run several checks. To avoid surprises, run these checks locally first. |
| 93 | + |
| 94 | +#### Prerequisites |
| 95 | +- [Podman](https://podman.io/) |
| 96 | + |
| 97 | +#### Running Code Quality Checks Locally |
| 98 | + |
| 99 | +1. Run the quality check script: |
| 100 | + ```shell |
| 101 | + ./development/code_quality.sh |
| 102 | + ``` |
| 103 | +2. Fix any identified issues |
| 104 | +3. Update your PR with fixes |
| 105 | +4. Verify CI passes in the updated PR |
| 106 | + |
| 107 | +#### Quality Check Details |
| 108 | + |
| 109 | +- **Linting with megalinter**: BASH, Markdown, YAML, GitHub Actions, security scanning |
| 110 | +- **License Compliance**: REUSE tool ensures proper copyright information |
| 111 | +- **Commit Structure**: Conform checks commit messages for changelog generation |
| 112 | +- **Dependency Analysis**: Scans for vulnerabilities, outdated packages, and license issues |
| 113 | +- **OpenSSF Scorecard**: Validates security best practices |
| 114 | + |
| 115 | +#### Handling Failed Checks |
| 116 | + |
| 117 | +If any checks fail in the CI pipeline: |
| 118 | + |
| 119 | +1. Review the CI error logs |
| 120 | +2. Run checks locally to reproduce the issues |
| 121 | +3. Make necessary fixes in your local environment |
| 122 | +4. Update your Pull Request |
| 123 | +5. Verify all checks pass in the updated PR |
| 124 | + |
| 125 | +## The Release Workflow |
| 126 | + |
| 127 | +Releases to Maven Central can be done via CI or locally. |
| 128 | + |
| 129 | +### Prerequisites |
| 130 | + |
| 131 | +1. **For CI releases**: |
| 132 | + - Push access to the repository (ability to push tags) |
| 133 | + - For production releases: Your GitHub username in AUTHORIZED_RELEASE_DEVELOPERS list |
| 134 | + - For SNAPSHOT releases: Any contributor with tag push access |
| 135 | + |
| 136 | +2. **For local releases only**: |
| 137 | + - Valid GPG key pair for signing artifacts |
| 138 | + - GPG key uploaded to key servers (e.g., `keyserver.ubuntu.com`) |
| 139 | + - Maven Central credentials in settings.xml |
| 140 | + |
| 141 | +### CI Release Process |
| 142 | + |
| 143 | +1. **For SNAPSHOT releases**: |
| 144 | + ```shell |
| 145 | + # Tag with -SNAPSHOT suffix (use -f to force if tag already exists) |
| 146 | + git tag -sf v0.0.1-SNAPSHOT -m 'v0.0.1-SNAPSHOT' |
| 147 | + # Push the tag to trigger the CI workflow (use -f to force update on remote) |
| 148 | + git push -f origin tag v0.0.1-SNAPSHOT |
| 149 | + ``` |
| 150 | + |
| 151 | + > **NOTE**: Always use the same SNAPSHOT tag version until ready for a production release. |
| 152 | +
|
| 153 | +2. **For Production releases**: |
| 154 | + ```shell |
| 155 | + # Tag with the desired version (no SNAPSHOT suffix) |
| 156 | + git tag -s v1.0.0 -m 'v1.0.0' |
| 157 | + # Push the tag to trigger the CI workflow |
| 158 | + git push origin tag v1.0.0 |
| 159 | + ``` |
| 160 | + |
| 161 | + > **NOTE**: The tag version will be used in the POM file. |
| 162 | +
|
| 163 | +3. **Monitor the workflow** in GitHub Actions to ensure successful completion. |
| 164 | + |
| 165 | + > **NOTE**: If the workflow fails due to authorization issues, contact the repository administrator to add your GitHub username to the AUTHORIZED_RELEASE_DEVELOPERS list. |
| 166 | +
|
| 167 | +### Local Release Process |
| 168 | + |
| 169 | +1. **Configure settings.xml**: |
| 170 | + - Ensure `.mvn/settings.xml` contains your Maven Central username and token |
| 171 | + - Verify credentials are in the correct server section with the proper server ID |
| 172 | + - Make sure your GPG key is available in your environment |
| 173 | + |
| 174 | +2. **Run the deploy command**: |
| 175 | + ```shell |
| 176 | + mvn deploy --settings .mvn/settings.xml -Pcentral-release |
| 177 | + ``` |
| 178 | + |
| 179 | +3. **Verify the release** in your Sonatype account or Maven Central. |
| 180 | + |
| 181 | +### Troubleshooting |
| 182 | + |
| 183 | +- For CI failures: Check GitHub Actions logs for detailed error information |
| 184 | +- For authorization issues: Verify your GitHub username is in AUTHORIZED_RELEASE_DEVELOPERS |
| 185 | +- For GPG problems: Ensure your key is correctly configured in your environment |
0 commit comments