Repository navigation
build: bind Google Java Format to Maven via Spotless (#833) - #849
Merged
Merged
Conversation
Replace the external `axel-op/googlejavaformat-action` CI step and the manual google-java-format JAR workflow with the spotless-maven-plugin, pinned to Google Java Format 1.25.2 in pom.xml. This gives a single source of truth for the format version shared by local and CI. - pom.xml: add spotless-maven-plugin (check bound to verify phase). - CI: lint-java now runs `mvn spotless:check` on JDK 17 instead of the GitHub Action. - CONTRIBUTING.md / AGENTS.md: document `mvn spotless:apply` / `mvn spotless:check` in place of the raw JAR command. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Spotless / Google Java Format normalizes line endings to LF, but 131 files under src/ were committed with CRLF, which would fail `mvn spotless:check` on a clean checkout. This is a pure line-ending normalization pass (no content reformatting): the byte content is identical once carriage returns are stripped. A scoped .gitattributes (`src/**/*.java text eol=lf`) keeps these sources LF going forward, matching what Spotless expects. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
| log.debug("classId was not null"); | ||
| notEmpty = (!classId.isEmpty()); | ||
| } | ||
| if (notEmpty && classId != null) { |
| log.debug("userId = " + userId); | ||
|
|
||
| // Validation | ||
| notNull = (moduleId != null); |
| boolean passwordChange = false; | ||
| boolean validPassword = false; | ||
| validData = | ||
| newPassword.equalsIgnoreCase(passwordConfirm) |
| log.debug("Checking for nulls"); | ||
| notNull = (userName != null && passWord != null); | ||
| log.debug("Ensuring strings are not empty"); | ||
| notEmpty = (!userName.isEmpty() && !passWord.isEmpty()); |
| log.debug("Checking for nulls"); | ||
| notNull = (userName != null && passWord != null); | ||
| log.debug("Ensuring strings are not empty"); | ||
| notEmpty = (!userName.isEmpty() && !passWord.isEmpty()); |
| log.debug("Ensuring strings are not empty"); | ||
| notEmpty = (!userName.isEmpty() && !passWord.isEmpty()); | ||
| log.debug("Validating passwords"); | ||
| validPasswords = passWord.compareTo(passWordConfirm) == 0; // 0 returned if the same |
| log.debug("Getting Parameters"); | ||
| String moduleId = (String) request.getParameter("moduleId"); | ||
| ; | ||
| log.debug("moduleId = " + moduleId.toString()); |
3 tasks
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #833.
Binds Google Java Format to the Maven build via the
spotless-maven-plugin, replacing the externalaxel-op/googlejavaformat-actionCI step and the manual JAR workflow. The format version is now pinned inpom.xml, giving a single source of truth shared by local and CI.Changes
Commit 1 —
build:plugin + CI + docspom.xml: addspotless-maven-plugin(2.44.5) configured with Google Java Format 1.25.2 (matching the version previously documented).spotless:checkis bound to theverifyphase, somvn verifyfails fast on unformatted code..github/workflows/test.yml:lint-javanow runsmvn spotless:checkon JDK 17 (matching the build/test jobs) instead of the GitHub Action.CONTRIBUTING.md/AGENTS.md: documentmvn spotless:apply/mvn spotless:checkin place of the rawjava -jar google-java-format ...command. Also corrected the stale "Java 24 for linting" note to Java 17.Commit 2 —
style:line-ending format passsrc/Java files were committed with CRLF line endings, which Spotless normalizes to LF — these would failmvn spotless:checkon a clean checkout (the old action tolerated them). This commit is a pure CRLF→LF normalization (byte content identical once CR is stripped; no content reformatting)..gitattributes(src/**/*.java text eol=lf) to keep these sources LF going forward.Verification
mvn spotless:check→ BUILD SUCCESS (227 files clean, 0 need changes) on JDK 17.spotless:checkruns duringmvn verify(verify-phase binding).Acceptance criteria
pom.xml, pinned to GJF 1.25.2.mvn verifyfails on unformatted Java sources.axel-op/googlejavaformat-actionreplaced withmvn spotless:check.CONTRIBUTING.mdandAGENTS.mdupdated.Note on overlap with #816
This touches 3 Java files (
Database.java,Setter.java,GetterIT.java) also modified by #816, due to the CRLF→LF normalization. I simulated the merge:pom.xml/AGENTS.md/CONTRIBUTING.mdauto-merge cleanly; the 3 Java files conflict but resolve mechanically by taking #816's content +mvn spotless:apply(verified format-clean, #816's logic fully intact). Recommend landing this first, then #816 rebases and runsmvn spotless:apply.🤖 Generated with Claude Code