How to override velocity templates

nexnova August 4, 2011

Hi!

I need to override some default macros from confluence. With a theme plugin, I can override with

<layoutkey="global"name="Global Decorator Portal"class="com.atlassian.confluence.themes.VelocityDecorator"overrides="/decorators/global.vmd"> <resourcetype="velocity"name="decorator"location="res/decorators/global.vmd"/> </layout>

the decorators. But how can I override templates like "/template/includes/menu-macros.vm" or somthing?


2 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

3 votes
Answer accepted
David Peterson
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 4, 2011

The short answer is, you can't. .vmd files are overridable because they are supported as layout plugin modules, as per your example. Regular .vm files are not - they are executed directly.

The only way to modify something like menu-macros.vm is to hijack the other vm file that is executing it, and have your hijacked version include your modified version of the vm file instead. And to hijack a vm file, you need to hijack the XWork Action that is pointing at that .vm file. And for that, you need the Conveyor Plugin:

https://studio.plugins.atlassian.com/wiki/display/LIBCNV/Conveyor+Plugin

Documentation is at the above location. Let me know if you have any questions.

Regards,

David Peterson

CustomWare | Sydney, Australia | www.customware.net | david.peterson@customware.net

Australia: +61 2 9900 5700 | Malaysia: +60 173 283 768 | US: +1 888 707 0088 (toll free)

The rocket has launched! www.trainingrocket.com

Jim Bethancourt
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 4, 2011

David -- is Conveyor 1.0 ready to work with Plugins 2 plugins? This would be very exciting news if it is.

David Peterson
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 5, 2011

Yes, it is. Version 1.0.1 has been officially released and both has more features and less bugs than 0.50, so it's a recommended upgrade if you're using Plugins 2. Check out the documentation for notes on getting it installed/bundled with your plugin.

0 votes
Martin Mitry May 6, 2012

Here is a link to an atlassian forum thread, just an info if other users might want to override breadcrumbs.vm.

http://forums.atlassian.com/thread.jspa?threadID=33856

Regards

TAGS
AUG Leaders

Atlassian Community Events