From 56f2d1d5f82479d5d55d33931143a9aa4febc579 Mon Sep 17 00:00:00 2001 From: Olivier Clavel Date: Thu, 20 Feb 2020 18:35:37 +0100 Subject: [PATCH] Backward compatibility for content selectors (#248) Fixes #242 --- files/groovy/create_content_selector.groovy | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/files/groovy/create_content_selector.groovy b/files/groovy/create_content_selector.groovy index 74beff29..bcb09351 100644 --- a/files/groovy/create_content_selector.groovy +++ b/files/groovy/create_content_selector.groovy @@ -12,8 +12,13 @@ SelectorConfiguration selectorConfig = selectorManager.browse().find { it -> it. if (selectorConfig == null) { update = false - selectorConfig = selectorManager.newSelectorConfiguration() - selectorConfig.setName(parsed_args.name) + try { + selectorConfig = selectorManager.newSelectorConfiguration() + selectorConfig.setName(parsed_args.name) + } catch (MissingMethodException) { + // Compatibility with nexus versions older than 3.20 + selectorConfig = new SelectorConfiguration('name': parsed_args.name) + } } selectorConfig.setDescription(parsed_args.description)