https://kotlinlang.org logo
Title
e

Erdem Tuna

08/30/2021, 9:35 AM
Hello, does anybody have an example of Gradle script with Kotlin DSL (
build.gradle.kts
) where I can input custom arguments when running? Actually, as I understand, I need to define new task that can take command-line input and invoke the main.
Are you talking about kotlinc or about Gradle tasks?
e

Erdem Tuna

08/30/2021, 9:38 AM
My task is indeed, running my project in a container with different input parameters. I thought I need to create a new task in
build.gradle.kts
and pass the parameters to it. That's why I asked this question indeed. If you have any recommendations, I appreciate it.
you can check -P and -D
p

Paul Griffith

08/30/2021, 4:10 PM
I think you just want to apply the
application
plugin: https://docs.gradle.org/current/userguide/application_plugin.html#header
Assuming you're talking about invoking your kotlin code with runtime command line arguments, not a gradle task
c

CLOVIS

08/31/2021, 7:09 AM
There's also
--args
now, which doesn't require creating a new Gradle task.