Installation¶
This guide will help you add Argos to your Kotlin project and get up and running quickly.
Requirements¶
- Kotlin: 2.2.10 or later
- Gradle: 7.0 or later (recommended: 8.0+)
- JVM: Java 11 or later (for JVM targets)
- Native: Appropriate toolchain for your target platform
Gradle Setup¶
Kotlin Multiplatform¶
Add Argos to your build.gradle.kts
file:
JVM Only¶
For JVM-only projects:
Multi-Module Project
Argos is organized as a multi-module project:
- argos: The core library (use this in your projects)
- argos-demo: Demo applications for testing and examples
Complete Multiplatform Example¶
Here's a complete build.gradle.kts
for a multiplatform CLI application:
plugins {
kotlin("multiplatform") version "2.2.10"
}
group = "com.example"
version = "1.0.0"
repositories {
mavenCentral()
}
kotlin {
jvm {
compilations.all {
kotlinOptions.jvmTarget = "11"
}
withJava()
testRuns["test"].executionTask.configure {
useJUnitPlatform()
}
}
linuxX64()
linuxArm64()
mingwX64()
sourceSets {
commonMain {
dependencies {
implementation("onl.ycode:argos:0.1.0")
}
}
commonTest {
dependencies {
implementation(kotlin("test"))
}
}
}
}
Maven Setup¶
For Maven projects, add to your pom.xml
:
<dependency>
<groupId>onl.ycode</groupId>
<artifactId>argos</artifactId>
<version>0.1.0</version>
</dependency>
Platform-Specific Notes¶
JVM¶
No additional setup required. Argos works out of the box on any JVM 11+ environment.
Native Linux¶
Supported architectures: - x64 (Intel/AMD 64-bit) - ARM64 (ARM 64-bit)
Windows¶
Supported via MinGW toolchain:
Windows Requirements
You'll need to install the MinGW-w64 toolchain. The easiest way is through: - MSYS2 (recommended) - TDM-GCC - Visual Studio Build Tools
Version Compatibility¶
Argos Version | Kotlin Version | Status |
---|---|---|
0.1.x | 2.2.10+ | Current |
IDE Setup¶
IntelliJ IDEA¶
- Import Project: Use "Import from existing sources" or open the
build.gradle.kts
file - Enable Kotlin Plugin: Should be enabled by default in recent versions
- Gradle Sync: Let IDEA download dependencies and set up the project
- Multiplatform Support: IDEA will automatically detect multiplatform configuration
VS Code¶
- Kotlin Extension: Install the official Kotlin extension
- Gradle Extension: Install the Gradle extension for build support
- Open Folder: Open your project folder in VS Code
Verify Installation¶
Create a simple test file to verify everything is working:
import onl.ycode.argos.Arguments
import onl.ycode.argos.parse
class TestApp : Arguments(
appName = "test",
appDescription = "Test Argos installation"
) {
val verbose by option("--verbose", "-v").bool().default(false)
.help("Enable verbose output")
val help by help()
}
fun main(args: Array<String>) {
val app = TestApp()
app.parse(args,
onSuccess = {
println("✅ Argos is working!")
println("Verbose mode: ${app.verbose}")
},
onError = { error, _ ->
println("Error: ${error.message}")
}
)
}
Build and Test¶
# Build the project
./gradlew build
# Run with help flag
./gradlew run --args="--help"
# Run with verbose flag
./gradlew run --args="--verbose"
Expected output:
Troubleshooting¶
Common Issues¶
Kotlin Version Mismatch¶
Solution: Update your Kotlin version to 2.2.10 or later:
Native Toolchain Missing¶
Could not find Native distribution. Run ':downloadKotlinNativeCompiler' or use 'kotlin.native.distribution' property
Solution: Let Gradle download the native compiler:
Dependency Resolution Issues¶
Solution: Ensure you have mavenCentral()
in your repositories:
Windows MinGW Issues¶
Solution: Install MinGW-w64 and add to PATH, or use MSYS2:
Getting Help¶
If you encounter issues:
- Check Version Compatibility: Ensure you're using compatible Kotlin/Gradle versions
- Clean Build: Run
./gradlew clean build
to clear any cached artifacts - Update Dependencies: Make sure you're using the latest Argos version
- GitHub Issues: Search existing issues or create a new one
Next Steps¶
Now that you have Argos installed, you can: