Spencer Bharath
Spencer Bharath

Reputation: 567

Executing gradle build tasks in custom tasks

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?

Upvotes: 7

Views: 5540

Answers (1)

yonisha
yonisha

Reputation: 3096

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.

Upvotes: 5

Related Questions