【问题标题】:How to split build.gradle file into files with smaller tasks [duplicate]如何将 build.gradle 文件拆分为具有较小任务的文件 [重复]
【发布时间】:2016-12-01 10:49:21
【问题描述】:

我的构建文件很大,很难维护,如何将构建文件拆分成单独的文件,将较小的任务导入到主gradle文件中

【问题讨论】:

    标签: java gradle


    【解决方案1】:

    build.gradle

    apply from: 'other.gradle'
    

    other.gradle

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

    gradle -q hello 的输出

    > gradle -q hello
    configuring root project 'configureProjectUsingScript'
    hello from other script
    

    来源:Configuring the project using an external build script

    【讨论】:

      猜你喜欢
      • 2012-06-26
      • 2012-06-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-07-31
      • 2011-07-13
      • 2019-10-02
      • 1970-01-01
      相关资源
      最近更新 更多