Search code examples
gradlekotlingradle-kotlin-dsl

How to add jvmArgs using kotlin dsl?


I need to open some javafx modules and I'm told to put it in the build.gradle.kts. I have no idea how to add jvmArgs to the run task with the kotlin DSL? Can someone show me how please.


Solution

  • You can configure default JVM arguments with JavaApplication extension:

    plugins { application }
    
    ...
    
    application {
      applicationDefaultJvmArgs = listOf("-Xmx2048m")
    }