How to mutate configurations and dependencies in a RuleSource plugin

I have started migrating my plugins to use the new model mechanism. I cannot find any documentation or examples of how to create a new configuration or add a dependency for that configuration. I have tried @Path and ModelMap but get a binding exception. I am using Gradle 2.5.

configurationHandler and dependenciesHandler have not yet been ported to the new model.
The ‘model’ task gives you the list of the things in the model space.
Beyond those things, you can add new elements with the @Model annotation, but you can’t use existing containers if they have not been ported yet.

You will have to live with the old and the new model for now. Sometimes this is not possible

Thanks Francois for the quick reply!

Right now there aren’t specific plans to port (“bridge” is often the term we use internally) these to model land. More likely is that we’ll provide a bridging mechanism to allow you to get at the Project and therefore everything else that is attached to it.

More specifically, dependencies will be handled differently with the software model (which is built on the new configuration model). Some support for this already exists in master and will be available in Gradle 2.7. The big missing bit is external dependency support which is in the works as we speak.

I’ve run into a similar problem, and I wonder if the external dependency support made it into 2.9? If so, is it documented anywhere?

External dependency management in the Java software model is coming in Gradle 2.10.

1 Like