To use the same version of Java locally as is used in CI and production, follow these notes.
Firstly build the project (without tests) by running:
./gradlew clean build -x test
To rebuild the docker image locally after building the project (perhaps after some new changes), run:
docker build -t quay.io/hmpps/hmpps-health-and-medication-api:latest .
./gradlew test
First, start the database and other required services via docker-compose with:
docker compose -f docker-compose-local.yml up
The service can then be run in the following ways:
./gradlew bootRun --args='--spring.profiles.active=dev'
Run the main class with the following VM options:
-Dspring.profiles.active=dev
In both of the above sections, dev
can be replaced with dev-postgres
to run against the postgres docker container
instead of h2.
docker-compose up
To list project dependencies, run:
./gradlew dependencies
To check for dependency updates, run:
./gradlew dependencyUpdates --warning-mode all
To run an OWASP dependency check, run:
./gradlew clean dependencyCheckAnalyze --info
To upgrade the gradle wrapper version, run:
./gradlew wrapper --gradle-version=<VERSION>
To automatically update project dependencies, run:
./gradlew useLatestVersions
To run Ktlint check:
./gradlew ktlintCheck
To run Ktlint format:
./gradlew ktlintFormat
To register pre-commit check to run Ktlint format:
./gradlew addKtlintFormatGitPreCommitHook
...or to register pre-commit check to only run Ktlint check:
./gradlew addKtlintCheckGitPreCommitHook