How to render AUI elements in a Velocity template?

Hello,

I have got a problem with velocity template rendering. AUI select is not rendered correctly.

My web resource:

<web-resource key="ca-sync-web-resources" name="CA Sync Web Resources">
    <dependency>com.atlassian.auiplugin:aui-select</dependency>
    <dependency>com.atlassian.auiplugin:ajs</dependency>
  </web-resource>
#requireResource("com.test.caSync:ca-sync-web-resources")
<html>
<head>
    <title>Add new synchronization scheme</title>
    <meta name="decorator" content="atl.admin">
</head>
<body>

in pom.xml:

<dependency>
            <groupId>com.atlassian.aui</groupId>
            <artifactId>auiplugin</artifactId>
            <version>8.5.0</version>
            <scope>provided</scope>
        </dependency>

Hi Vaclav,

have you tried WebResourceManager?

See Atlassian documentation for more details:
https://developer.atlassian.com/server/jira/platform/web-resource/

Regards,
Josef

Hi! Thanks, I have solved it myself. I will now post and share how did I do it as sadly there are almost no examples on “how to” and I spent some time то find out. You need to use pageBuilderService and add this in java:

private static final Logger log = LoggerFactory.getLogger(SynchronizationSchemeEdit.class);
    private static final String VM_TEMPLATE_NAME = "synchronization-scheme-edit";

@ComponentImport
    @Inject
    private PageBuilderService pageBuilderService;

@Override
    public String execute() throws Exception {
        pageBuilderService.assembler().resources().requireWebResource(PLUGIN_KEY_NAME+":"+ PLUGIN_WEB_RESOURCE_COMPONENTS);
        return VM_TEMPLATE_NAME;
    }