Kotlin & Spring boot project template for rapid development setup.
Template branches:
-
main
- Simplest. -
spring-data-jpa
- JPA on simplest version
-
Build tool:
-
Languages and Platforms:
-
Frameworks and environments:
-
Code quality measurements:
-
Automatic documentation
It is better to declare JAVA_HOME
environment variable and make java
command executable via PATH
before following these instructions.
./gradlew clean assemble [-PbuildConfig=<local|alpha|beta|release>]
-
buildConfig
is set tolocal
by default, if omitted or set to wrong value. -
Stand-alone JAR executable is created under
app-main/build/libs
afterassemble
task is ran.
You must create application.yml
file on project root or execution context root directory before running project. There is application.yml.sample
on project root, for quick reference.
After a successful build, run server as following:
java -jar app-main/build/libs/{app-name}-{app-version}.jar
Tests must be organised by execution time, and they could be grouped as three categories:
-
Small test: a.k.a. 'Unit test', must be run quickly and frequently.
-
Medium test: a.k.a. 'Integration test', must be run before code check-in.
-
Large test: a.k.a. 'End-to-end test', must be run before code integration.
You can find detailed rules for test groups in TestTags.kt.
-
Running tests:
gradlew [<smallTest|mediumTest|largeTest>|test] [jacocoTestReport]
test
for running all tests, and other options for running tests in group, respectively. -
Getting test reports:
Test reports are automatically generated under
build/reports
directory of each module after all tests are run. -
Getting code coverage reports:
Running Gradle task
jacocoTestReport
while running tests will generate reports underbuild/reports/jacoco
both in XML and HTML formats.
Simply, run tests that involving actual API calls and with asciidoctor
task as following:
gradlew [<smallTest|mediumTest|largeTest>|test] asciidoctor
However, it is advised to run such tests in a large scale - group them as largeTest
- to provide a documentation that reflects client’s point of view as much as possible.
Thus, in this template project all endpoint
tests are marked as TestTags.TEST_LARGE
by default in RestAssuredTestBase class.
-
Generating detekt code analysis report
gradlew [:<GRADLE_MODULE_NAME>:]detekt
detekt report file is created as
build/reports/detekt.html
per module if module name is omitted. -
Generating jacoco code coverage report
gradlew [<smallTest|mediumTest|largeTest>|test] jacocoTestReport
jacoco coverage report file is created under
build/reports/jacoco/
directory if tests are executed successfully.