Skip to content

build: bind Google Java Format to Maven via Spotless (#833) - #849

Merged
ismisepaul merged 2 commits into
devfrom
dev#833
May 29, 2026
Merged

ismisepaul merged 2 commits into
devfrom
dev#833

Conversation

@ismisepaul

Copy link
Copy Markdown
Member

Closes #833.

Binds Google Java Format to the Maven build via the spotless-maven-plugin, replacing the external axel-op/googlejavaformat-action CI step and the manual JAR workflow. The format version is now pinned in pom.xml, giving a single source of truth shared by local and CI.

Changes

Commit 1 — build: plugin + CI + docs

  • pom.xml: add spotless-maven-plugin (2.44.5) configured with Google Java Format 1.25.2 (matching the version previously documented). spotless:check is bound to the verify phase, so mvn verify fails fast on unformatted code.
  • .github/workflows/test.yml: lint-java now runs mvn spotless:check on JDK 17 (matching the build/test jobs) instead of the GitHub Action.
  • CONTRIBUTING.md / AGENTS.md: document mvn spotless:apply / mvn spotless:check in place of the raw java -jar google-java-format ... command. Also corrected the stale "Java 24 for linting" note to Java 17.

Commit 2 — style: line-ending format pass

  • The repo was already format-clean against GJF 1.25.2 except that 131 src/ Java files were committed with CRLF line endings, which Spotless normalizes to LF — these would fail mvn spotless:check on 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).
  • Adds a scoped .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.
  • Confirmed spotless:check runs during mvn verify (verify-phase binding).

Acceptance criteria

  • Plugin added to pom.xml, pinned to GJF 1.25.2.
  • mvn verify fails on unformatted Java sources.
  • CI updated: axel-op/googlejavaformat-action replaced with mvn spotless:check.
  • CONTRIBUTING.md and AGENTS.md updated.
  • Repo is format-clean against the pinned version (line-ending normalization isolated to its own commit).

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.md auto-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 runs mvn spotless:apply.

🤖 Generated with Claude Code

ismisepaul and others added 2 commits May 29, 2026 21:13
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());
@ismisepaul
ismisepaul merged commit 8107c02 into dev May 29, 2026
14 checks passed
@ismisepaul ismisepaul moved this from Backlog to Done in Security Shepherd May 29, 2026
@ismisepaul ismisepaul added this to the 4.0.0 milestone Oct 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Bind Google Java Format to Maven build (replace external CI action)

1 participant