Only require the  task where is needed.

Backport of 4b8b8c1b4d1b516a9ebf8e19d5a14956c5654ac8