Executing gradle build tasks in custom tasks

╄→гoц情女王★ 提交于 2019-12-10 17:54:55

问题


I have a custom task in gradle Called release and I want this task to execute the clean and build tasks:

task release
{
    //do something
    clean
    build
}

I know it is possible to call tasks from command line like

gradle build release

But I want to know wether it is possible to execute build tasks within custom tasks?


回答1:


You can simply use 'finalizedBy' feature either by configure it inside 'release' task:

task release
{
    finalizedBy clean, build

    // Do some stuff
}

or configure it after 'release' task:

release.finalizedBy clean, build

Note that this feature is currently in incubation and may change in the future.



来源:https://stackoverflow.com/questions/38751650/executing-gradle-build-tasks-in-custom-tasks

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!