• Gradle Goodness: Excluding Tasks for Execution


    In Gradle we can create dependencies between tasks. But we can also exclude certain tasks from those dependencies. We use the command-line option -x or --exclude-task and specify the name of task we don't want to execute. Any dependencies of this task are also excluded from execution. Unless another task depends on the same task and is executed. Let's see how this works with an example:

    00.task copySources << {
    01.println 'Copy sources.'
    02.}
    03. 
    04.task copyResources(dependsOn: copySources) << {
    05.println 'Copy resources.'
    06.}
    07. 
    08.task jar(dependsOn: [copySources, copyResources]) << {
    09.println 'Create JAR.'
    10.}
    11. 
    12.task deploy(dependsOn: [copySources, jar]) << {
    13.println 'Deploy it.'
    14.}

    We execute the deploy task:

    $ gradle -q deploy
    Copy sources.
    Copy resources.
    Create JAR.
    Deploy it.

    Now we exclude the jar task. Notice how the copySources task is still executed because of the dependency in the deploy task:

    $ gradle -q deploy -x jar
    Copy sources.
    Deploy it.
  • 相关阅读:
    SQLite的sqlite_sequence表
    缓存区溢出漏洞工具Doona
    SQLite的sqlite_master表
    dfs1321
    三维bfs(HUD1253胜利大逃亡)
    dfs模版
    poj3259: Wormholes(BF模板题)
    Bellman-Ford算法
    POJ1611:The Suspects(模板题)
    poj3126
  • 原文地址:https://www.cnblogs.com/GoAhead/p/4189133.html
Copyright © 2020-2023  润新知