Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Jira plugin doesn't render velocity

Minh Trieu January 14, 2020

I'm developing a plugin (web panel) but it doesn't load any velocity template/code.

 

Following this: https://developer.atlassian.com/server/jira/platform/web-panel/#web-panel-examples

I tried the static resource and it rendered correctly but when it comes to velocity, the location nor the embedded version doesn't show anything.

blank.png

My atlassian-plugin.xml

<web-panel key="release-page-key" location="path">
<resource name="view" type="velocity"><![CDATA[My name is test]]></resource>
<context-provider class="path-to-class"/>
<condition class="com.atlassian.jira.plugin.webfragment.conditions.UserLoggedInCondition"/>
</web-panel>

As you can see, I tried the embedded velocity code, but all it shows is empty blank page. Only the static version works, i.e.

<web-panel key="release-page-key" location="cz.oksystem.plugins.jira.webpanel:dependency-graph">
<resource name="view" type="static"><![CDATA[Hello World]]></resource>
<context-provider class="cz.oksystem.plugins.jira.webpanel.DependencyGraphServlet"/>
<condition class="com.atlassian.jira.plugin.webfragment.conditions.UserLoggedInCondition"/>
</web-panel>

notblank.png

Other than this, I didn't change anything. Am I missing something?

 

I'm currently using Atlassian plugin SDK 8.0.7

 

---

SOLUTION:

I imported this dependency

<dependency>
<groupId>com.atlassian.templaterenderer</groupId>
<artifactId>atlassian-template-renderer-api</artifactId>
<version>3.0.0</version>
<scope>provided</scope>
</dependency>

2 answers

0 votes
Minh Trieu January 14, 2020

OK nvm, I found my solution. The only thing I had to do was to import the dependency

 

<dependency>
<groupId>com.atlassian.templaterenderer</groupId>
<artifactId>atlassian-template-renderer-api</artifactId>
<version>3.0.0</version>
<scope>provided</scope>
</dependency>
0 votes
DPKJ
Community Champion
January 14, 2020

@Minh Trieu  You will need to add location of velocity file, so your atlassian-plugin.xml should look like this,

<web-panel key="release-page-key" location="path">
<resource name="view" type="velocity" location="templates/view.vm" />
<context-provider class="path-to-class"/>
<condition class="com.atlassian.jira.plugin.webfragment.conditions.UserLoggedInCondition"/>
</web-panel>

and templates/view.vm (inside resources directory of your plugin) should look like,

<h1>My name is Test</h1>
Minh Trieu January 14, 2020

I already tried this, but it doesn't do anything. I tried the three variants mentioned here: https://developer.atlassian.com/server/jira/platform/web-panel/#web-panel-examples but none of them are working for velocity. The embedded and the location file

Minh Trieu January 14, 2020

This is how the project structure looks like. I tried again exactly what you've suggested but nothing happened. Still a blank page

 

Untitled.png

Suggest an answer

Log in or Sign up to answer