Micronaut CLI Template
A ready to go Kotlin Micronaut command line application template with the tooling I like already set up: a Gradle version catalogue, Kotlinter and Detekt, Arrow, Strikt, and GitHub Actions and Dependabot for CI. Click "Use this template" on GitHub to start from it.
A ready to go template for command line apps written in Kotlin with Micronaut and Picocli. It starts from the standard Micronaut CLI application and adds the tooling and libraries I set up on every project, so a new tool can start with the interesting part.
Features
- A Gradle version catalogue (
gradle/libs.versions.toml) for every dependency and plugin - Java 25 through a Gradle toolchain
- Kotlinter for formatting and Detekt for static analysis, with its own configuration
- Arrow for functional programming
- Strikt for test assertions, including its Arrow support
- Commands that return proper exit codes
- A GitHub Actions build on every push and pull request to
main - Daily Dependabot updates for Gradle dependencies, and dependency submission for security alerts
Requirements
- Java 25 or later
Usage
Click Use this template on GitHub to create a new repository from it. Then make it your own:
- Change the project name in
settings.gradle.ktsandsrc/main/resources/application.properties. - Rename the
com.examplepackage insrc/mainandsrc/test. - Use the same package in
build.gradle.kts:group,mainClassand themicronautannotationssetting. - Rename or replace
DemoCommand.
The template builds and runs as it is:
./gradlew build
./gradlew run --args="--verbose"
./gradlew build also runs the tests, Kotlinter and Detekt. To fix formatting, run ./gradlew formatKotlin.
Learn more
- Micronaut user guide
- Micronaut Picocli guide
- Micronaut Gradle plugin
- Micronaut Kotlin annotation processing (kapt)
Licence
Apache 2.0. See LICENSE.