How to make Java Classes in Jira Plugin accessible to custom .JSP Pages

Hi there,

I'm working on bringing forward our custom Jira plugin forward to Jira 5.2.2 from Jira 4.1.2 .

The plugin just adds some links to the nav bar that point to some custom .jsp pages we've written, which are found in Jira's root.

I've updated all the API usage such as OSUser etc to meet new Jira standards, however I'm running in to an issue with the new version-2 type plugins - my jsp pages can't seem to access the Java classes contained in the plugin. Error given is "Only a type can be imported. com.blah.ClassX resolves to a package".

In the old version-1 plugin the plugin .jar was placed under WEB-INF/lib so the pages could access the code without a problem but obviously this is not the case with newer plugins.

I take it there is a way around this? From what I've read I suspect it may involve the use of either "Components" or "Webworks" but I don't know enough about either of these to really know how to get started.

My current atlassian-plugin.xml looks like:

<?xml version="1.0" encoding="UTF-8"?>

<atlassian-plugin key="${project.groupId}.${project.artifactId}" name="${}" plugins-version="2">
    <vendor name="${}" url="${project.organization.url}"/>
    <param name="plugin-icon">images/pluginIcon.png</param>
    <param name="plugin-logo">images/pluginLogo.png</param>
  <!-- add our i18n resource -->
  <resource type="i18n" name="i18n" location="companystabs"/>
  <!-- add our web resources -->
  <web-resource key="companytabs-resources" name="companytabs Web Resources">
    <resource type="download" name="companytabs.css" location="/css/companytabs.css"/>
<resource type="download" name="images/" location="/images"/> <context>companytabs</context>
</web-resource> <!-- import from the product container --> <component-import key="applicationProperties" interface="com.atlassian.sal.api.ApplicationProperties"/> <web-section name="companyTabs" i18n-name-key="" key="company-tabs" location="companyTabs" weight="1000">
<description key="company-tabs.description">The company Tabs Web-section</description>
<label key="company-tabs.label"/>
</web-section> <web-item name="Roadmap" i18n-name-key="" key="roadmap" section="" weight="1000"> <description key="roadmap.description">The company Roadmap menu item.</description>
<label key="roadmap.label"/> <link linkId="roadmap-link">/roadmap.jsp</link> </web-item> <web-item name="Service Packs" i18n-name-key="" key="service-packs" section="" weight="1000"> <description key="service-packs.description">The company Service Packs menu item.</description>
<label key="service-packs.label"/> <link linkId="service-packs-link">/supportRoadmap.jsp</link> </web-item> <web-item name="Research" i18n-name-key="" key="research" section="" weight="1000"> <description key="research.description">The company Research menu item.</description>
<label key="research.label"></label> <link linkId="research-link">/researchList.jsp</link> </web-item> </atlassian-plugin>

Any suggestions?


1 answer

1 accepted

2 votes
Accepted answer

Can you provide the source of your jsp. Do you need access to classes from JIRA or your own classes ?

You can just try to implement your jsps as webwork actions using velocity templates or you might be able to just point the action the the jsp without making it velocity file (buy putting it like that - <viewname="createuserissue">/templates/myjspfile.jsp</view> in the atlassian-plugin.xml.)

You can use these resources for reference :

I suggest that you first try to implement a "Hellow world" page and then try to plug your existing jsp there.

Hi Boris, thanks for responding.

The JSPs need access to our own classes, a large number of them located in the plugin under src/main/java/com/company/*classes* .

There are quite a number of JSPs and they're very long so I probably shouldn't post them here but it's all just pretty standard JSP stuff - at the top a bunch of 'import's for all the classes the page needs, then just snippets of code using these classes throughout the page and some include's .

I will look at those links and try and get my head around the webworks stuff now, thanks. Hopefully converting to using velocity isn't a lot of work or it probably won't be feasible here, or hopefully just pointing it to the JSP might work as you say.



Did you find any solution? Having the same issue here...

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Jan 08, 2019 in Jira

How to Jira for designers

I’m a designer on the Jira team. For a long time, I’ve fielded questions from other designers about how they should be using Jira Software with their design team. I’ve also heard feedback from other ...

1,140 views 4 9
Read article

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you