Example of jatJar task using Gradle Kotlin DSL:
val mainClass = "com.github.daggerok.Main" // replace it!
tasks {
register("fatJar", Jar::class.java) {
archiveClassifier.set("all")
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
manifest {
attributes("Main-Class" to mainClass)
}
from(configurations.runtimeClasspath.get()
.onEach { println("add from dependencies: ${it.name}") }
.map { if (it.isDirectory) it else zipTree(it) })
val sourcesMain = sourceSets.main.get()
sourcesMain.allSource.forEach { println("add from sources: ${it.name}") }
from(sourcesMain.output)
}
}
ktor:
environment: $ENV. this is my application.yaml file how to pass $ENV value from ./gradlew runFatJar command