我如何通过Groovy将路由规则与Nexus OSS上的代理仓库关联起来?

问题描述 投票:0回答:1

我已经能够使用Nexus groovy脚本,更具体地创建一个路由规则到现有的仓库。

创建一个很容易;这样的代码在Groovy中评估得很好:RoutingRule routingRule = new RoutingRule("com.company only API", "only com.company content", RoutingMode.BLOCK, ["^(?!comcompany).*\$"])

我想不通的是,如何将这个规则持久化,并将其附加到现有的版本库中。我试着用: Configuration.setRoutingRuleId(EntityHelper.id(ruleName))但没有成功。

有谁知道正确的配置是将代理资源库与路由规则关联起来?

Nexus OSS版本:3.19.1-01。

编辑:我通过更新我的Nexus版本到OSS 3.21.1-01,并开始使用API,现在他们有RoutingRules方法,解决了我的问题。

groovy nexus nexus3
1个回答
0
投票

不知道你是否在这里找到了答案,因为它已经有两个月了。我也遇到了这个问题,花了很长时间才弄明白,所以对于正在寻找的人来说。

def rule = routingRuleStore.getByName('RULENAME')
config.routingRuleId = org.sonatype.nexus.common.entity.EntityHelper.id(rule)

那么你可以用以下方法保存update

repositoryManager.create(config)
repositoryManager.update(config)
© www.soinside.com 2019 - 2024. All rights reserved.