Quick start
This page walks through the everyday commands. It assumes you have installed Kargo.
Create a project
Section titled “Create a project”$ kargo new hello Created application `hello` package$ cd helloKargo creates this:
hello/├── kargo.toml├── .gitignore├── src/│ └── Main.kt└── tests/ └── GreetingTest.ktsrc/Main.kt contains a small program:
package com.example.hello
fun greeting(name: String): String = "Hello, $name!"
fun main() { println(greeting("Kotlin"))}Run it
Section titled “Run it”$ kargo run Compiling hello v0.1.0 (jvm) Finished `dev` profile [unoptimized + debuginfo] target(s) in 2.47s Running `java com.example.hello.MainKt`Hello, Kotlin!The first run downloads the Kotlin compiler, so it takes a little longer. Later runs only recompile when something changed.
Pass arguments to your program after --:
kargo run -- --name WorldTest it
Section titled “Test it”tests/GreetingTest.kt uses kotlin.test, which works on every target:
package com.example.hello
import kotlin.test.Testimport kotlin.test.assertEquals
class GreetingTest { @Test fun greetsByName() { assertEquals("Hello, Kargo!", greeting("Kargo")) }}kargo testAdd a dependency
Section titled “Add a dependency”$ kargo add org.jetbrains.kotlinx:kotlinx-datetimeWithout a version, Kargo picks the latest release and writes it to kargo.toml:
[dependencies]"org.jetbrains.kotlinx:kotlinx-datetime" = "0.7.1"The resolved versions and checksums go into kargo.lock. Commit both files.
Build and package
Section titled “Build and package”kargo build # debug build in target/debug/jvm/kargo build --release # release build in target/release/jvm/kargo package --release # one runnable fat jarjava -jar target/release/jvm/hello-0.1.0-all.jarOther templates
Section titled “Other templates”kargo new mylib --lib # a library instead of an appkargo new app -t jvm,wasm,native # several targets at oncekargo new api -w ktor # a Ktor serverkargo new web -w spring-boot # a Spring Boot appkargo new ui -w compose # a Compose Desktop appkargo new phone -t android -w compose # a Jetpack Compose Android appkargo init # set up the current directory insteadCheat sheet
Section titled “Cheat sheet”| Command | Short | What it does |
|---|---|---|
kargo build |
kargo b |
Compile |
kargo run |
kargo r |
Build and run |
kargo test |
kargo t |
Build and run tests |
kargo add <coords> |
Add a dependency | |
kargo remove <coords> |
kargo rm |
Remove a dependency |
kargo outdated |
List dependencies with newer versions | |
kargo upgrade |
Raise versions in kargo.toml |
|
kargo tree |
Show the dependency graph | |
kargo clean |
Delete target/ |
|
kargo info |
Show project information |
Full details are in the command reference.