Execute Custom Task in Root Project


(Gunnar Hillert) #1

How do I reference/use the ‘preBuild’ property? I am trying to execute a custom task, that verifies that all sub-projects have a populated description. The custom task shall be executed for any build execution. As I am executing a multi-module project, I saw people referencing the following code:

preBuild.dependsOn(checkProjectDescriptions)

This, however, gives me:

‘Could not find property ‘preBuild’ on root project…’

As a work-around, I am doing:

‘tasks[‘checkProjectDescriptions’].execute()’ as the last statement in ‘build.gradle’. But this does not look very clean. So I am wondering is there something that I am missing or should do rather instead?

Thanks a million!


(Mark Vieira) #2

Where are you seeing people referencing this? Prebuild isn’t a lifecycle task that’s added by any of the core Gradle plugins.