Add dependency to GenerateIvyDescriptor task

I’m using the new ivy-publish plugin to create a custom publication. Before the GenerateIvyDescriptor task is executed, I need a custom task to be run. Specifically, I need to build the Ivy dependencies by resolving Gradle/Ivy configurations. This can’t be done at Gradle configuration time due to ordering dependencies between plugins afterEvaluate.

The problem is that the rule creating the GenerateIvyDescriptor task is immutable. Gradle throws an exception when I try to add a new dependency from the GenerateIvyDescriptor task onto my custom task.

Is this not possible in Gradle 2.2 (the version I’m using)? Assuming not, how do you see this working going forward?