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?
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
.
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..
According to https://bitbucket.org/atlassian/atlassian-spring-scanner
component-import
is not needed. You can replace it by @ComponentImport
annotation in your Java.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With