Skip to main content

Gradle 属性文件

info

Gradle 中,属性可以在构建脚本属性文件命令行参数来定义。 对于特殊场景,通常在命令行上声明属性。例如,您可能想要传递一个特定的属性值来控制构建的这一次调用的运行时行为。 构建脚本中的属性很容易成为维护问题,并使构建脚本逻辑变得复杂。 gradle.properties 文件有助于将属性与构建脚本分离,是放置控制构建环境的属性的好位置。 gradle.properties 属性文件可在项目根目录中,其定义的属性可用于当前项目。如果希望将属性文件应用于机器上的所有构建,可以将其放在 GRADLE_USER_HOME 目录中。

# System properties (the same effect as the -D option of the java command)
systemProp.org.gradle.internal.publish.checksums.insecure = true
# Gradle properties
org.gradle.jvmargs = --add-opens java.base/sun.nio.ch=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED
# Private properties ()
maven_release_username = foo
maven_release_password = bar
maven_snapshot_username = foo
maven_snapshot_password = bar