Contains strict PMD linting and pre-commit settings, can be used as a starting
template for a Java project.
Please ensure the prerequisites are satisfied before proceeding. In Java, you can first compile the main code, and then run it with CLI arguments.
clear && ./gradlew build shadowJar && \
java -jar build/libs/template-java-project-all.jarOr, after building:
java -jar fat.jarPut your unit test files (with extension .bats) in folder: /test/
./gradlew testThen, in browser open:
build/reports/tests/test/classes/com.doctestbot.TestCommandLineParser.html
and browse to related section.
To run 1 test file specifically, for example the
/test/java/com/doctestbot/cli/TestLogArg.java test file:
clear && ./gradlew test --tests com.doctestbot.TestSourceDirArgNote that the /cli drops out.
(Re)-install the Java with:
sudo apt install openjdk-21-jdk-headless
sudo curl -s "https://get.sdkman.io" | bash
source ~/.sdkman/bin/sdkman-init.sh
sdk --version
sdk install gradle
sdk install java 19.0.2-openInstall:
# Java hooks require docker
sudo apt install docker.io
# Ensure docker can be ran without sudo.
sudo groupadd docker
sudo gpasswd -a $USER docker
newgrp docker
# Install pre-commit
pre-commit install
pre-commit autoupdateAuto update of gradle.build file is not a standard practice. Instead, get
the list of latest versions of the things that can be updated:
./gradlew dependencyUpdatesand manually apply the updates.
Run pre-commit with:
pre-commit run --allTo generate the documentation, run:
./gradlew javadocThat produces the documentation in build/docs/javadoc/index.html,
Still has to be implemented.