Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Where to put velocity template for macro plugin?

I want to render a velocity template for my macro plugin. I placed the template in a folder under the resources folder. However, whenever I try to use the macro, this error shows up:

org.apache.velocity.exception.ResourceNotFoundException: Unable to find resource path to velocity template

I even tried specifying the absolute path and it didn't work.


My code:

import com.atlassian.confluence.content.render.xhtml.ConversionContext;import com.atlassian.confluence.macro.Macro;import com.atlassian.confluence.macro.MacroExecutionException;import com.atlassian.confluence.util.velocity.VelocityUtils;import com.atlassian.confluence.renderer.radeox.macros.MacroUtils;
import java.util.Map;
public class MermaidLiveEditorMacro implements Macro {
    public String execute(Map<StringString> map, String s, ConversionContext conversionContext) throws MacroExecutionException {        
// do something with params ...        
String code = map.get("Code");        
String sampleDiagrams = map.get("Sample Diagrams");
        Map context = MacroUtils.defaultVelocityContext();        
"Code"), code);        
"Sample-diagrams"), sampleDiagrams);        
return VelocityUtils.getRenderedTemplate(absolute path to velocity template, context);    

     public BodyType getBodyType() { return BodyType.PLAIN_TEXT; }
     public OutputType getOutputType() { return OutputType.BLOCK; }}



0 answers

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Confluence

👁‍🗨 Confluence Team planning dashboard_Atlympics 🌈

Hi Atlassian's, How is your journey with #Atlympics 2021 so far....excited! Me too, same excitement. Here's my typical team planning and vision dashboard which I used to share to my management and ...

46 views 1 3
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you