Groovy scripts with yml

Hi Hippos,

When I create a Groovy updater script in the cms and export it as yml file, the script itself becomes quite unreadable in the exported yml file; the script becomes a big blob of code and newlines/carriage returns. Is there a way to have this either better formatted or, even better, have the Groovy script as a separate file?

Edit: I know there’s a maven plugin by Openweb that does this, but I’d rather not introduce third party modules if I don’t have to.

Cheers,
Rick

You can define the Groovy script as an “External Resource” (see [1]). But this doesn’t interoperate perfectly with auto-export if I remember correctly, so your external resource should probably be the source or truth, rather than editing the repository-based script in the CMS’ Updater Editor.

Tobi

[1] https://www.onehippo.org/library/concepts/configuration-management/yaml-format.html

Thanks for your reply. It doesn’t matter if auto-export doesn’t work perfectly, I prefer not to use that anyway. I’ll look into the external resource thing, sounds like that’s exactly what I need. If I run into any trouble I’ll report back.

Thanks,
Rick

A bit late in reporting back, but the external resource setup worked like a charm.