How rrajesh1979/ref-java-cli works
Project type and purpose
• This is a reference Java command‑line interface (CLI) application called “mychecksum.”
• Purpose: compute file checksums (MD5 by default, or other algorithms like SHA‑1/SHA‑256) and print results to STDOUT.
• Built with Java, Maven, Picocli for CLI parsing, GraalVM native-image packaging via JReleaser, and automated CI/CD via GitHub Actions.
File structure
• Top‑level files & directories:
• pom.xml, mvnw/mvnw.cmd, .mvn/wrapper → Maven build setup
• src/main/java/org/rrajesh1979/demo/MyCheckSum.java → core CLI entry point & checksum logic
• src/test/java/org/rrajesh1979/demo/MyCheckSumTest.java → unit tests (JUnit/Spock)
• src/main/assembly/assembly.xml → assembly descriptor for packaging
• jreleaser.yml → configuration for native-image builds and artifact release
• .github/workflows/*.yml → CI pipelines for code‑quality checks and release
• .gitpod.yml, .gitpod.Dockerfile → cloud IDE dev environment
• No frontend or external microservices—single-binary CLI tool.
README for additional insights
• Key features list technologies (Java, Maven, JReleaser, Picocli, GitHub Actions).
• Usage examples show how Picocli parses parameters and how native binary gets installed via Homebrew.
• Configuration section calls out necessary secrets and tokens for CI/CD and release.
a. User & CLI interface
• User invokes “mychecksum” command in a shell.
• Picocli parses arguments, validates input.
b. Core checksum service
• MyCheckSum.java:
• Reads file via Java I/O
• Applies selected MessageDigest algorithm
• Produces hex digest string
c. Packaging & distribution
• Maven build: compiles, runs tests, produces JAR.
• JReleaser + GraalVM native‑image: produces platform‑specific executables.
• GitHub Actions release workflow:
• Triggers on tag → uses jreleaser.yml → publishes binaries to GitHub Releases & Homebrew tap.
d. Continuous integration
• GitHub Actions code‑quality checks workflow: runs static analysis (SpotBugs/Checkstyle), unit tests, coverage (Codecov), and SonarCloud quality gate.
e. Development environment
• Gitpod: automated dev environment using .gitpod.Dockerfile & .gitpod.yml.
Architectural patterns & design principles
• Single-responsibility: CLI parsing (Picocli) isolated from business logic (checksum).
• Modular packaging: clear separation of build (Maven), release (JReleaser), and runtime (native-image).
• Automated CI/CD pipeline: infrastructure-as-code via GitHub workflows.