java-commons is a multi-module Maven parent project that provides reusable Java commons libraries. It is authored by Caleb Cushing and licensed under Apache-2.0.
- Group ID:
com.xenoterracide - Artifact ID:
java-commons-parent - Current Version:
0.0.0 - Java Release: 21
The repository also embeds a shared tooling subtree under .share/ that supplies git hooks, AI-assisted merge workflows, and cross-project linting configuration.
- Java: 21+ (Temurin recommended, managed via
asdf) - Build Tool: Apache Maven (wrapper:
./mvnw) - Node.js: 24.14.1 (managed via
yarn4 with Plug'n'Play) - Python: 3.14.3 (managed via
uv)
- Compiler:
maven-compiler-pluginwithrelease=21 - Static Analysis: Error Prone + NullAway (compile-time), SpotBugs, Checkstyle
- Coverage: JaCoCo with a minimum 90% instruction coverage rule
- Testing: JUnit 5 (Jupiter), AssertJ, Vavr (test scope)
- Javadoc:
doclint=all,-missing
.
├── pom.xml # Parent POM
├── module/
│ └── tools/ # Current library module
│ ├── pom.xml
│ └── src/
│ ├── main/java/
│ │ ├── module-info.java
│ │ └── com/xenoterracide/tools/java/
│ │ ├── annotation/ # e.g. @Initializer, @ExcludeFromGeneratedCoverageReport
│ │ ├── collection/ # ArrayTools, CollectionTools
│ │ ├── function/ # ExceptionTools, PredicateTools
│ │ └── util/ # ObjectTools
│ └── test/java/
│ ├── module-info.java
│ └── com/xenoterracide/blackbox/ # Black-box tests
├── .config/
│ ├── checkstyle/
│ │ ├── main.xml # Checkstyle rules for production code
│ │ └── test.xml # Checkstyle rules for test code
│ ├── spotbugs/
│ │ └── exclude.xml # SpotBugs suppression filter
│ └── git/hooks/ # commit-msg and pre-commit hooks
├── .github/
│ ├── renovate.json5 # Renovate Bot configuration
│ └── workflows/
│ ├── build.yml # Reusable Maven build workflow
│ └── pre-commit.yml # License + Prettier checks
├── .share/ # Shared tooling subtree (git hooks, merge scripts)
├── .mvn/
│ └── jvm.config # JDK compiler exports for Error Prone
├── package.json # Node dev-tool manifest (prettier, lint-staged, etc.)
├── pyproject.toml # Python project metadata (uv)
└── REUSE.toml # REUSE license compliance overrides
# Compile, test, and run all quality checks (checkstyle, spotbugs, jacoco)
./mvnw verify
# Run only unit tests
./mvnw test
# Run a specific module
./mvnw -pl module/tools verify
# Skip checks during development (use sparingly)
./mvnw test -Dcheckstyle.skip=true -Dspotbugs.skip=true -Djacoco.skip=true# Install Node dependencies and set up git hooks
yarn contribute
# Run all workspace tests (includes shared tooling type-checks)
yarn test
# Run linting (prettier + REUSE license compliance)
yarn lint
yarn lint:prettier
yarn lint:reuse# Sync Python environment (includes `reuse` tool for license compliance)
uv sync --frozen --group dev- Indent: 2 spaces
- Line endings: LF
- Charset: UTF-8
- Print width: 120 characters (Prettier)
- Trailing whitespace: trimmed
- Final newline: required
All source files are formatted with Prettier (including Java via prettier-plugin-java).
- Prefer
varover explicit types where readable. - Prefer immutability:
finalfields,recordclasses,List.of(), unmodifiable collections. - Prefer package-private visibility over
privatefor methods and classes; fields should remainprivate. - Use non-null by default:
- Modules and packages are annotated with
@NullMarked. - Use
@Nullableonly when a value can genuinely be null.
- Modules and packages are annotated with
- Utility classes must have a
privateno-arg constructor and befinal. - Every package must contain a
package-info.javawith appropriate Javadoc and@NullMarked. - Imports: static imports first, then third-party, sorted alphabetically; no star imports.
- Every file must have an SPDX header.
- Java source files use
SPDX-License-Identifier: Apache-2.0. - Configuration/XML/TOML/YAML/JSON5 files use
CC0-1.0. - Shell scripts and JS/CJS files use
MIT. - Markdown/ADoc use
CC-BY-NC-SA-4.0.
lint-stagedautomatically adds headers viareuse annotateon commit.
- Tests live in
src/test/javaunder thecom.xenoterracide.blackboxpackage (black-box testing style). - The test module (
module-info.java) opens its packages toorg.junit.platform.commons. - Maven Surefire runs unit tests on the module path (
useModulePath=true). - JaCoCo enforces ≥ 90% instruction coverage.
- SpotBugs and Checkstyle run on both main and test code.
# Fast feedback loop
./mvnw -pl module/tools test
# Full verification (use before pushing)
./mvnw verifyCommit messages are validated by a git hook. Allowed types (from git-conventional-commits.yaml):
ci, feat, fix, perf, refactor, style, test, build, ops, docs, chore, merge, revert
Hooks are located in .config/git/hooks and referenced via core.hooksPath .share/git/hooks:
- pre-commit: runs
lint-staged(format + license headers) - commit-msg: validates conventional commit format
The .share/ subtree provides merge scripts for different AI agents:
yarn merge:kimi # Kimi CLI merge workflow
yarn merge:junie # Junie CLI merge workflow
yarn merge:copilot # GitHub Copilot merge workflow- CI Detection: All git hooks exit immediately when
[ -n "$CI" ]is true. - Lockfile Integrity: Yarn installs use
--immutableto prevent unexpected lockfile mutations. - JVM Config:
.mvn/jvm.configexports required JDK compiler internals safely for Error Prone/NullAway. - Dependency Updates: Renovate is configured with automerge for minor/patch Maven updates and scheduled grouping for npm/asdf dev dependencies.
- Install prerequisites via
asdf(reads.tool-versions):asdf install
- Run the contribute script to install Node/Python deps and configure hooks:
yarn contribute
- Verify the build:
./mvnw verify