Gradle - Can properties be placed in a settings.gradle.kts

Viewed 4060

Is it possible to place these settings which I currently have in gradle.properties in my settings.gradle.kts file?

org.gradle.parallel=true
org.gradle.caching=true

Thanks

2 Answers

No, this is not possible since gradle.properties configures the JVM that runs the Gradle build and settings.gradle.kts configures the project once the JVM has started and the build starts up. See the documentation on the build environment

In my experience you can't do it.

You can check the gradle properties in the official doc.

The configuration is applied in following order (if an option is configured in multiple locations the last one wins):

  • gradle.properties in project root directory.

  • gradle.properties in GRADLE_USER_HOME directory.

  • system properties, e.g. when -Dgradle.user.home is set on the command line.

These properties are used to sep up the environment for your build:

org.gradle.caching=(true,false)
org.gradle.caching.debug=(true,false)
org.gradle.configureondemand=(true,false)
org.gradle.console=(auto,plain,rich,verbose)
org.gradle.daemon=(true,false)
org.gradle.daemon.idletimeout=(# of idle millis)
org.gradle.debug=(true,false)
org.gradle.java.home=(path to JDK home)
org.gradle.jvmargs=(JVM arguments)
org.gradle.logging.level=(quiet,warn,lifecycle,info,debug)
org.gradle.parallel=(true,false)
org.gradle.warning.mode=(all,none,summary)
org.gradle.workers.max=(max # of worker processes)
org.gradle.priority=(low,normal)

Also you can apply the same rules to settings.gradle and settings.gradle.kts.In the documentation:

Gradle defines a settings file. The settings file is determined by Gradle via a naming convention. The default name for this file is settings.gradle. The settings file is executed during the initialization phase.

And looking at the Settings class in the API documentation

There is a one-to-one correspondence between a Settings instance and a settings.gradle settings file.

You can check the properties that you can initialize with this file.

Related