Is it possible to pass custom program arguments to...
# gradle
t
Is it possible to pass custom program arguments to default nodeDevelopmentRun task?
t
could you tell the type of this task via
./gradlew help --task nodeDevelopmentRun
?
a
Probably you are interested in something like this?
Copy code
tasks.named<org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsExec>("nodeDevelopmentRun") {
    nodeArgs = mutableListOf("--my-brand-new-argument")
}
1
t
I needed to pass parameter specific to my local test environment, so I ended up with this:
Copy code
val config: String? by project
if (config != null) {
    println(".config: $config")
    tasks.withType(NodeJsExec::class).all {
        println("config: $config")
        args("--config", config)
    }
}
As Alexander mentioned, task type is org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsExec and nowhere in this type hierarchy I could find any
@Option
, nor in indication in docs that would imply that passing args as command line argument is anyhow supported.