gradle custom task execution phase -


this question gradle (>= 2.4). write custom task following:

https://docs.gradle.org/current/userguide/custom_tasks.html

class greetingtask extends defaulttask {     @taskaction     def greet() {         println 'hello greetingtask'     } }  task hello(type: greetingtask) 

how can make task run during execution phase? passing empty closure with

<< {  } 

the solution?

edit

the task supposed used in multiproject build several tasks dependencies.

i'd command gradle build build projects saying

`build.dependson(hello)` 

but seems task hello called during configuration phase of build.

add following build.gradle file:

class greetingtask extends defaulttask {     @taskaction     def greet() {         println 'hello greetingtask'     } }  task hello(type: greetingtask) {     println "this configuration phase"      dofirst {         println "this execution phase"     } } 

now execute gradle hello. output see is

this configuration phase :hello execution phase hello greetingtask  build successful 

as can see, output task occurs after dofirst(), happens during execution phase.


Comments

Popular posts from this blog

searchKeyword not working in AngularJS filter -

sequelize.js - Sequelize: sort by enum cases -

user interface - how to replace an ongoing process of image capture from another process call over the same ImageLabel in python's GUI TKinter -