Create
cancel
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

How to include an inner Velocity Template within a Velocity Template

I would like to reuse a template inside multiple other template and I looked in Apache Velocity Template and I found what I am looking for

 

## Load the file one.vm into this template
#include( "one.vm" )

However when I tried it in Jira it didn't work. Most probable because of the path

So I tried to change the path to the vm by trying all of the below

#include("./src/main/resources/templates/one.vm")
#include("src/main/resources/templates/one.vm")
#include("./one.vm")
#include("templates/one.vm")

 

 but I keep getting an exception. Does anyone know how to achieve this in Jira?

 

Exception

Exception getting message body from Velocity: org.apache.velocity.exception.VelocityException: Cannot process content resource
[INFO] [talledLocalContainer] org.apache.velocity.exception.VelocityException: Cannot process content resource
[INFO] [talledLocalContainer] at org.apache.velocity.runtime.resource.ContentResource.process(ContentResource.java:89)
[INFO] [talledLocalContainer] at org.apache.velocity.runtime.resource.ResourceManagerImpl.loadResource(ResourceManagerImpl.java:446)
[INFO] [talledLocalContainer] at org.apache.velocity.runtime.resource.ResourceManagerImpl.getResource(ResourceManagerImpl.java:354)
[INFO] [talledLocalContainer] at org.apache.velocity.runtime.RuntimeInstance.getContent(RuntimeInstance.java:1444)
[INFO] [talledLocalContainer] at org.apache.velocity.runtime.directive.Include.renderOutput(Include.java:229)
[INFO] [talledLocalContainer] at org.apache.velocity.runtime.directive.Include.render(Include.java:155)
[INFO] [talledLocalContainer] at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:175)
[INFO] [talledLocalContainer] at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72)
[INFO] [talledLocalContainer] at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:87)
[INFO] [talledLocalContainer] at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:336)
[INFO] [talledLocalContainer] at org.apache.velocity.Template.merge(Template.java:328)
[INFO] [talledLocalContainer] at org.apache.velocity.Template.merge(Template.java:235)
[INFO] [talledLocalContainer] at org.apache.velocity.app.VelocityEngine.mergeTemplate(VelocityEngine.java:381)

 

1 answer

1 accepted

2 votes
Answer accepted

Hi

Have you tried?

#parse("/templates/one.vm")

Regards

Like # people like this

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Marketplace Apps & Integrations

5 mobile apps for Jira Cloud to boost productivity

  It’s very important to have access to the workflow process from anywhere. Especially if you manage the work of others. There is no difference whether you’re out of office, or drive a ca...

249 views 2 5
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