Java command-line library catalog that models books and members, supports interactive checkout commands, and persists catalog state to a flat file.
- Java 21+ compatible source level
- Maven
- JUnit 5
- Executable jar packaging via Maven JAR Plugin
- Install JDK 21 or a compatible newer JDK.
- Clone the repository.
- Open a terminal in the project root.
- Use the committed Maven wrapper scripts instead of requiring a separate Maven install.
This project currently requires no environment variables. See .env.example.
Run the Maven test suite:
.\mvnw.cmd testBuild the executable jar:
.\mvnw.cmd -q packageRun the CLI help:
java -jar target/library-catalog.jar helpPrint the packaged application version:
java -jar target/library-catalog.jar --versionInvalid commands now return a stable non-zero exit code with a user-facing error message instead of a raw stack trace.
Bootstrap a missing catalog with sample data only on first run:
java -jar target/library-catalog.jar bootstrap --data temp-catalog.txtSeed a new catalog:
java -jar target/library-catalog.jar seedAdd a book and member:
java -jar target/library-catalog.jar add-book book-010 "Domain-Driven Design" "Eric Evans"
java -jar target/library-catalog.jar add-member member-010 "Jamie Cross"Remove an available book or an idle member:
java -jar target/library-catalog.jar remove-book book-010
java -jar target/library-catalog.jar remove-member member-010Checkout and inspect the catalog:
java -jar target/library-catalog.jar checkout book-010 member-010
java -jar target/library-catalog.jar list-books
java -jar target/library-catalog.jar list-members
java -jar target/library-catalog.jar find-book "domain"
java -jar target/library-catalog.jar find-member "jamie"
java -jar target/library-catalog.jar loan-report
java -jar target/library-catalog.jar overdue-reportGitHub Actions runs ./mvnw -q package on every push to main and every pull request targeting main.
Not deployed. This is a local Java command-line project.
This build now uses a conventional Maven project layout instead of an ad hoc compile script and custom test runner. The application code lives under src/main/java, the tests live under src/test/java, and JUnit 5 now drives the test suite. On top of that, the Maven build now produces a runnable jar, so the project is no longer just source you can build; it is a CLI artifact you can package and launch directly with java -jar. The internal Java packages now use a real namespace, com.breakingthebot.librarycatalog, which makes the codebase look and behave like a conventional Java project instead of a temporary scaffold. This iteration also moves the checkout flow closer to a real lending system by assigning a default 14-day due date on checkout, persisting that date with the catalog, and exposing a dedicated overdue report so the CLI can separate active loans from late ones.
- The project now uses Maven with JUnit 5 instead of the earlier custom test harness.
- The default catalog file is
data/library-catalog.txt. - Any command can target a different file with
--data <path>. - Commands currently supported:
help,version,--version,bootstrap,seed,add-book,add-member,remove-book,remove-member,checkout,return,list-books,list-members,find-book,find-member,loan-report, andoverdue-report. - Continuous integration lives in
.github/workflows/java-ci.ymland runs./mvnw -q packageon JDK 21. - CLI boundary errors now return stable exit codes and clear messages with a
helphint. bootstrapseeds sample data only when the target catalog file does not already exist; it never overwrites an existing file.checkoutassigns a default due date 14 days from the checkout date.loan-reportnow shows due dates and whether each active loan is overdue.overdue-reportonly lists loans whose due dates are already in the past.remove-bookonly works for available books, andremove-memberonly works for members with no active loans.- The primary distributable artifact is
target/library-catalog.jar. - The code now uses the
com.breakingthebot.librarycatalogpackage namespace across production and test code. --versionreads Maven metadata from the packaged artifact and prints the current application version.