Atlassian Plugin with dependencies disabled

Muhammad Ramzan(Atlassian Certified Master)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 24, 2019

I am developing a jira plugin with bamboo specs dependencies. I am stuck at very initial stage

 

Problem is , if i am adding the dependencies and installing the plugin to JIRA, its disabled. If i remove the dependencies plugin works fine.

 

Could you please advise, how can i fix this issue.

 

<build>
<plugins>
<plugin>
<groupId>com.atlassian.maven.plugins</groupId>
<artifactId>jira-maven-plugin</artifactId>
<version>${amps.version}</version>
<extensions>true</extensions>
<configuration>
<productVersion>${jira.version}</productVersion>
<productDataVersion>${jira.version}</productDataVersion>
<extractDependencies>false</extractDependencies>
<!-- Uncomment to install TestKit backdoor in JIRA. -->
<!--
<pluginArtifacts>
<pluginArtifact>
<groupId>com.atlassian.jira.tests</groupId>
<artifactId>jira-testkit-plugin</artifactId>
<version>${testkit.version}</version>
</pluginArtifact>
</pluginArtifacts>
-->
<enableQuickReload>true</enableQuickReload>
<!--<enableFastdev>false</enableFastdev>-->

<!-- See here for an explanation of default instructions: -->
<!-- https://developer.atlassian.com/docs/advanced-topics/configuration-of-instructions-in-atlassian-plugins -->
<instructions>
<Atlassian-Plugin-Key>${atlassian.plugin.key}</Atlassian-Plugin-Key>

<!-- Add package to export here -->
<Export-Package>
com.elm.jira.library.api,
</Export-Package>

<!-- Add package import here -->
<Import-Package>
org.springframework.osgi.*;resolution:="optional",
org.eclipse.gemini.blueprint.*;resolution:="optional",
com.atlassian.bamboo.service.*;resolution:="optional",
*
</Import-Package>

<!-- Ensure plugin is spring powered -->
<Spring-Context>*</Spring-Context>
</instructions>
</configuration>
</plugin>

 

 

these are the dependencies i am using

<dependency>
<groupId>com.atlassian.bamboo</groupId>
<artifactId>bamboo-specs-api</artifactId>
<version>6.9.1</version>
</dependency>

<dependency>
<groupId>com.atlassian.bamboo</groupId>
<artifactId>bamboo-specs</artifactId>
<version>6.9.1</version>
</dependency>

 

Exception

2019-07-24 14:44:15,911 UpmAsynchronousTaskManager:thread-4 ERROR mh694x53420x4 qt2t1k /rest/plugins/1.0/available/featured [c.a.p.osgi.factory.OsgiPluginInstalledHelper] 
Cannot determine required plugins, cannot resolve bundle
'com.elm.jira.library-test.jira-library' 2019-07-24 14:44:15,926 UpmAsynchronousTaskManager:thread-4 ERROR mh694x53420x4 qt2t1k /rest/plugins/1.0/available/featured [c.a.p.osgi.factory.OsgiPlugin] Detected an error
(BundleException) enabling the plugin
'com.elm.jira.library-test.jira-library' : Unable to resolve
com.elm.jira.library-test.jira-library
[302](R 302.0): missing requirement
[com.elm.jira.library-test.jira-library
[302](R 302.0)]
osgi.wiring.package; (osgi.wiring.package=org.apache.avalon.framework.logger) Unresolved requirements: [[com.elm.jira.library-test.jira-library [302](R 302.0)] osgi.wiring.package;
(osgi.wiring.package=org.apache.avalon.framework.logger)].
This error usually occurs when your plugin imports
a package from another
bundle with a specific version
constraint and either the
bundle providing
that package
doesn't meet those
version constraints, or there is no bundle available that provides the specified package. For more details on how to fix this, see https://developer.atlassian.com/x/mQAN 2019-07-24 14:44:15,926 UpmAsynchronousTaskManager:thread-4 WARN 694x53420x4 qt2t1k /rest/plugins/1.0/available/featured [c.a.plugin.impl.AbstractPlugin]
Unable to enable plugin 'com.elm.jira.library-test.jira-library' 2019-07-24 14:44:15,926 UpmAsynchronousTaskManager:thread-4 WARN 694x53420x4 qt2t1k /rest/plugins/1.0/available/featured [c.a.plugin.impl.AbstractPlugin] Because of this exception com.atlassian.plugin.osgi.container.OsgiContainerException: Cannot start plugin: com.elm.jira.library-test.jira-library at com.atlassian.plugin.osgi.factory.OsgiPlugin.enableInternal(OsgiPlugin.java:424) at com.atlassian.plugin.impl.AbstractPlugin.enable(AbstractPlugin.java:252) at com.atlassian.plugin.manager.PluginEnabler.actualEnable(PluginEnabler.java:120) at com.atlassian.plugin.manager.PluginEnabler.enable(PluginEnabler.java:97) at com.atlassian.plugin.manager.DefaultPluginManager.lambda$enableDependentPlugins$22(DefaultPluginManager.java:1246) at com.atlassian.plugin.manager.PluginTransactionContext.wrap(PluginTransactionContext.java:63) at com.atlassian.plugin.manager.DefaultPluginManager.enableDependentPlugins(DefaultPluginManager.java:1230) at com.atlassian.plugin.manager.DefaultPluginManager.lambda$addPlugins$20(DefaultPluginManager.java:1215) at com.atlassian.plugin.manager.PluginTransactionContext.wrap(PluginTransactionContext.java:63) at com.atlassian.plugin.manager.DefaultPluginManager.addPlugins(DefaultPluginManager.java:1115) at com.atlassian.jira.plugin.JiraPluginManager.addPlugins(JiraPluginManager.java:157) at com.atlassian.plugin.manager.DefaultPluginManager.lambda$scanForNewPlugins$12(DefaultPluginManager.java:920) at com.atlassian.plugin.manager.PluginTransactionContext.wrap(PluginTransactionContext.java:63) at com.atlassian.plugin.manager.DefaultPluginManager.scanForNewPlugins(DefaultPluginManager.java:875) at com.atlassian.plugin.manager.DefaultPluginManager.lambda$installPlugins$11(DefaultPluginManager.java:835) at com.atlassian.plugin.manager.PluginTransactionContext.wrap(PluginTransactionContext.java:63) at com.atlassian.plugin.manager.DefaultPluginManager.installPlugins(DefaultPluginManager.java:821) at com.atlassian.jira.plugin.JiraPluginManager.installPlugins(JiraPluginManager.java:167)

 

1 answer

0 votes
Marco Paleani March 28, 2024

try to add these to your <instructions> (see Apache Felix Maven Bundle Plugin (BND) for details)

 

<Embed-Transitive>true</Embed-Transitive>

 

<Bundle-ClassPath>.,{maven-dependencies}</Bundle-ClassPath>

<Embed-Dependency>*;scope=compile|runtime</Embed-Dependency>

<Embed-Directory>META-INF/lib</Embed-Directory>

Suggest an answer

Log in or Sign up to answer