Is gradle declarative or imperative build tool?

2.4k Views Asked by At

I suppose gradle uses build scripts that can be programmed as per the requirements. Is it a declarative or imperative build tool then?

1

There are 1 best solutions below

1
ToYonos On BEST ANSWER

In fact, it's both. Gradle does not force you to be declarative like Maven or imperative like Ant, it can and it will probably be both for you.

According to Gradle's documentation :

Well-designed build scripts consist mostly of declarative configuration rather than imperative logic

As far as you can, use the Gradle's DSL and only use custom conditional blocks when you need to handle specific cases or custom actions.