Hi!
I was following the tutorial here:
And in the tutorial I added the 4 SAL modules in Step 1. And as the tutorial shows, 4 component-imports show up in the atlassian-plugin.xml file. However, when I try to run it as the tutorial says, I get this error:
atlassian-plugin.xml contains a definition of component-import. This is not allowed when Atlassian-Plugin-Key is set
Based on this error, I tried going to pom.xml and commenting out the line that defines Atlassian-Plugin-Key. Doing so allowed atlas-run to complete successfully, but then when I go to the servlet link it appears blank and nothing shows up no matter what I try.
Any assistance would be great.
Community moderators have prevented the ability to post new answers.
The tutorial is out of date. Newer versions of the SDK use Atlassian Spring Scanner instead of <component>
and <component-import>
.
You have 2 options:
I think I understand it a little bit. I see how they write the code for Spring Scanner Annotations, but I'm really new to this. Which code file to I add the annotations to?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sorry I'm really confused. I assume I need to import the java files into my main servlet file. But I don't know how to write the code for simple plugins in the tutorial.
For instance, I have these 4 components:
<component-import key="templateRenderer" interface="com.atlassian.templaterenderer.TemplateRenderer" filter=""/>
<component-import key="userManager" interface="com.atlassian.sal.api.user.UserManager" filter=""/>
<component-import key="loginUriProvider" interface="com.atlassian.sal.api.auth.LoginUriProvider" filter=""/>
<component-import key="pluginSettingsFactory" interface="com.atlassian.sal.api.pluginsettings.PluginSettingsFactory" filter=""/>
They're the simple components used in the tutorial, but I have no idea how to set this up using the Spring Scanners.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
err.... atlas-create-jira-plugin-module -> 1: Component Import still does the old outdated way...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Could you please provide more information how to "Use the Spring Scanner Annotations (recommended)"?
Or maybe you could point to some page that explains how to do that for TemplateRenderer and UserManager?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This answer might help.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you, that was helpful! One more note: for getting the current user, I use this:
private ApplicationUser getCurrentUser(HttpServletRequest req) { return ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser(); }
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You shouldn't really mix injection and use of ComponentAccessor
they do the same thing. You should be able to inject the JiraAuthenticationContext
in the same way you inject UserManager
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you very much for letting us know that and providing a solution. Right now I'm a little bit irritated by the official tutorials that somehow seem to be very outdated and don't make working with Atlassian SDK a breeze
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@firestarter2prometheus You can check answer here for modern versions of pom, atlassian-plugin and *.java files from tutorials
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Found answer HERE.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.