Gradle 中引用外部Gradle脚本,相当于import/include功能

原文地址

Configuring the project using an external build script

You can configure the current project using an external build script. All of the Gradle build language is available in the external script. You can even apply other scripts from the external script.

Configuring the project using an external build script
build.gradle

apply from: 'other.gradle'

other.gradle

println "configuring $project"
task hello << {
    println 'hello from other script'
}

Output of gradle -q hello

configuring root project 'configureProjectUsingScript'
hello from other script

你可能感兴趣的:(Gradle 中引用外部Gradle脚本,相当于import/include功能)