How to run a Gradle Tasks before building an Intellij Idea Project

This should be that way to go.

It should be possible to edit the xml from idea that way to set this by default.
But this would only work when doing gradle idea