I'm working on my plugin writing skills (I'm still a beginner), and right now I'm trying to do a very simple exercise where I display an image on a page. I know how to edit the velocity template to include the necessary HTML, however my main goal here is to use a local resource that I have included with the plugin source/JAR (as opposed to a publicly available image on the internet). I've read documentation, various posts in this forum, and more...... but I still can't get it to work. I always just get a broken image icon and the web traffic logs give a 404 saying it can't find the image at that URL (I've tried many different variations of the URL, but nothing seems to work).
Here's my atlassian-plugin.xml:
<?xml version="1.0" encoding="UTF-8"?> <atlassian-plugin key="${project.groupId}.${project.artifactId}" name="${project.name}" plugins-version="2"> <plugin-info> <description>${project.description}</description> <version>${project.version}</version> <vendor name="${project.organization.name}" url="${project.organization.url}"/> <param name="plugin-icon">images/pluginIcon.png</param> <param name="plugin-logo">images/pluginLogo.png</param> </plugin-info> <resource type="i18n" name="i18n" location="tutorial-jira-add-content-to-view-issue-screen"/> <web-resource key="tutorial-jira-add-content-to-view-issue-screen-resources" name="tutorial-jira-add-content-to-view-issue-screen Web Resources"> <dependency>com.atlassian.auiplugin:ajs</dependency> <resource type="download" name="images/" location="images/"/> <context>tutorial-jira-add-content-to-view-issue-screen</context> </web-resource> <component-import key="applicationProperties" interface="com.atlassian.sal.api.ApplicationProperties"/> <web-panel name="DueDateIndicator" i18n-name-key="due-date-indicator.name" key="due-date-indicator" location="atl.jira.view.issue.left.context" weight="201"> <description key="due-date-indicator.description">The DueDateIndicator Plugin</description> <context-provider class="com.example.plugins.tutorial.DueDateIndicator"/> <resource name="view" type="velocity" location="due-date-indicator.vm"/> <label key="due-date-indicator.title"/> </web-panel> </atlassian-plugin>
And here's my velocity template:
<img src="$req.contextPath/download/resources/com.example.plugins.tutorial:tutorial-jira-add-content-to-view-issue-screen-resources/images/1.png">
And yes, before you ask, I do indeed have the images folder located at src/main/resources/images with the files that I want.
Community moderators have prevented the ability to post new answers.
I've tried many different variations of the addon key, but nothing seems right...... I can't seem to find any documentation that clearly specifies where I can find my addon key. If it is just groupId.artifactId as you suggest, then technically my addon key is com.example.plugins.tutorial.tutorial-jira-add-content-to-view-issue-screen. I've tried that key, however, and I still can't get to my images...
There are should not be any wonders here. Check that your addon key (i.e. groupId.artifactId) is "com.example.plugins.tutorial".
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Jordan, check what is actual rendered output from you Velocity template.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I've taken a look at the actual rendered output, and you're right, the link isn't being generated correctly ($req.contextPath isn't turning into the actual context path). However, I've tried entering the supposedly correct URL directly into the address bar of my browser, and it still doesn't work. I know that something as simple as this shouldn't be so complicated, but it's been blocking my for weeks now....
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Community moderators have prevented the ability to post new answers.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.