Edit list of dependencies before publishing to Maven or Ivy repository

Is it possible to change the dependencies published to a Maven or Ivy repository? The use case is the Gradle Shadow plugin where dependent jar’s are relocated to be contained within a jar and these included jar’s are removed as dependencies. Of course, I can do this in the withXml closure but it is clumsy and would require corresponding changes to the Ivy withXml to properly support that mode of publishing. Can I manipulate the runtime dependencies right before they are used for Maven (and Ivy) publication?

Not in any really safe way, as you can’t really guarantee that no one else is going to need the data.

The only viable option I can see is to use the xml hook.

Thanks Luke.