Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

223
Views
How to distribute a Kotlin CLI application?

I've built a small bot in Kotlin.

It's finished and I can run it from my developer tools. I am using the application plugin to attempt distribution but I keep failing.

./gradlew run runs the bot as expected.

I was looking for something like ./gradlew installDist and then just running installationDir/bin/App (similar to Ktor apps) and running the app. But it just exits successfully with no output when I should see a lot of logging output.

What am I doing wrong?

// gradle.build.kts
import org.jetbrains.kotlin.gradle.plugin.statistics.ReportStatisticsToElasticSearch.url
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
    kotlin("jvm") version "1.5.31"
    kotlin("plugin.serialization") version "1.5.31"
    application
}

group = "me.nanospicer"
version = "1.0"

repositories {
    mavenCentral()
    maven {
        url = uri("https://jitpack.io")
    }
}


tasks.withType<KotlinCompile>() {
    kotlinOptions.jvmTarget = "1.8"
}

application {
    mainClass.set("MainKt")
}

val ktor_version="1.6.5"
dependencies {
    implementation("ch.qos.logback:logback-classic:1.2.7")
    implementation("io.ktor:ktor-client-core:$ktor_version")
    implementation("io.ktor:ktor-client-cio:$ktor_version")
    implementation("io.ktor:ktor-client-serialization:$ktor_version")
    implementation("io.ktor:ktor-client-logging:$ktor_version")
    implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.1")
}
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

  • Good news: The setup posted on my question works flawlessly.
  • Bad news: My code didn't.

I had a file that didn't exist on the server and a part of the code was returning null so the app would quit without any output because it wouldn't do anything due to the file being non-existent.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!