Create and attach routing rule via Groovy scripting

You need to persist your routing rule using the RoutingRuleStore, once you do this you can use EntityHelper.id(routingRule) to obtain the EntityId to set on the configuration.

However you should also not modify the configuration that you get from a Repository, that won’t persist any change and in many cases the rest of Nexus will not be aware of your modification. Use Configuration.copy() to create a copy of the existing configuration, make your modifications, then use RepositoryManager.update()

We’ve added a few REST APIs for creating and modifying repositories but not all formats are complete yet.