Dev Jira version: 9.12.11
Atlas-sdk: 9.0.2
JDK: 17
I’m using Jsoup in my Jira plugin.
Jsoup is a part of jira-core dependency
When i try install my plugin, without any changes in my pom.xml i have a exception:
com.atlassian.plugin.osgi.container.OsgiContainerException: Cannot start plugin: plugin_name
...
Caused by: org.osgi.framework.BundleException: Unable to resolve plugin_name [294](R 294.0): missing requirement [plugin_name [294](R 294.0)] osgi.wiring.package; (osgi.wiring.package=org.jsoup) Unresolved requirements: [[plugin_name [294](R 294.0)] osgi.wiring.package; (osgi.wiring.package=org.jsoup)]
I have a jsoup.jar in my Jira Instance WEB-INF/lib, and another plugins, like Scriptrunner use Jsoup without any exceptions (may be they have bundle with jsoup)
So, if i change my pom.xml Import section for this:
<Import-Package>
org.springframework.osgi.*;resolution:="optional",
org.eclipse.gemini.blueprint.*;resolution:="optional",
*;resolution:="optional"
</Import-Package>
Plugin was successful installed.
But when i execute operation with Jsoup, i caught exception:
java.lang.NoClassDefFoundError: org/jsoup/Jsoup
...
Caused by: java.lang.ClassNotFoundException: org.jsoup.Jsoup not found by plugin_name [295]
When i added dependency in plugin pom.xml:
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>${jsop.version}</version>
<scope>provided</scope>
</dependency>
i have same exception.
Only one solution works for me: add jar in bundle (scope - compiled) and add exclusion to amps banned dependency:
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>${jsop.version}</version>
</dependency>
...
<banningExcludes>
<exclude>org.jsoup:jsoup</exclude>
</banningExcludes>
But honestly, i’m not a big fan of this kind of solution.
Can someone help with better solution? Have no idea