[英]Gradle - Can properties be placed in a settings.gradle.kts
Is it possible to place these settings which I currently have in gradle.properties
in my settings.gradle.kts
file?是否可以将我目前在
gradle.properties
中的这些设置放在我的settings.gradle.kts
文件中?
org.gradle.parallel=true
org.gradle.caching=true
Thanks谢谢
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.不,这是不可能的,因为
gradle.properties
配置运行 Gradle 构建的 JVM,并且settings.gradle.kts
在 JVM 启动和构建启动后配置项目。 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 .您可以在官方文档中查看 gradle 属性。
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
。
gradle.properties
in GRADLE_USER_HOME directory.gradle.properties
在 GRADLE_USER_HOME 目录中。system properties, eg when
-Dgradle.user.home
is set on the command line.系统属性,例如在命令行上设置
-Dgradle.user.home
时。
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
.您也可以将相同的规则应用于
settings.gradle
和settings.gradle.kts
。 In the documentation : 在文档中:
Gradle defines a settings file.
Gradle 定义了一个设置文件。 The settings file is determined by Gradle via a naming convention.
设置文件由 Gradle 通过命名约定确定。 The default name for this file is
settings.gradle
.此文件的默认名称是
settings.gradle
。 The settings file is executed during the initialization phase .设置文件在初始化阶段执行。
And looking at the Settings
class in the API documentation并查看API 文档中的
Settings
类
There is a one-to-one correspondence between a Settings instance and a
settings.gradle
settings file.Settings 实例和
settings.gradle
设置文件是一一对应的。
You can check the properties that you can initialize with this file.您可以检查可以使用此文件初始化的属性。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.