10

This is what I get when I run atlas-create-jira-plugin followed by atlas-create-jira-plugin-module selecting option 1: Component Import.

The problem is that all tutorial examples appear to have plugin descriptor generated by old SDK version (that won't deploy with newer versions of SDK/Jira at all), which do not feature Atlassian-Plugin-Key, so I can't find my way to import a component.

I'm using SDK 6.2.3 and Jira 7.1.1.

Any hint - how to get this sorted out?

3 Answers 3

8

anonymous is correct. The old way of doing things was to to put the <component-import> tag in your atlassian-plugin.xml. The new way and also recommended is to use Atlassian Spring Scanner. When you create your add-on using atlas-jira-create-plugin and your pom.xml has the <Atlassian-Plugin-Key> tag and the dependencies atlassian-spring-scanner-annotation and atlassian-spring-scanner-runtime then you are using the new way.

If you have both the dependencies, you are using Atlassian Spring Scanner version 1.x. If you only have atlassian-spring-scanner-annotation then you are using version 2.x.

You don't have to omit/comment out Atlassian-Plugin-Key in your pom.xml and you don't have to put component-import in your atlassian-plugin.xml.

For example, you want to add licensing for your add-on and need to import the component PluginLicenseManager. You just go straight to the code and your constructor might look like this:

@Autowired
public MyMacro(@ComponentImport PluginLicenseManager licenseManager) {
    this.licenseManager = licenseManager;
}

And your class like this:

@Scanned
public class MyMacro implements Macro {

If memory serves me right, be sure to check for null because sometimes Atlassian Spring Scanner can't inject a component. I think on version 1, writing an @EventListener, it could not inject a ConversionContext. But when writing a Macro, it was able to inject a ConversionContext.

5

According to https://bitbucket.org/atlassian/atlassian-spring-scanner

component-import is not needed. You can replace it by @ComponentImport annotation in your Java.

4

Found answer here: https://developer.atlassian.com/docs/advanced-topics/configuration-of-instructions-in-atlassian-plugins

It looks like I've somehow been missing that Atlassian-Plugin-Key can be omitted, and it must be done when you need to import components.

This key just tells spring not to 'transform' plugin's Spring configuration, which must happen as part of components import process..

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.