Jira 10 Platform 7 plugin development 3rd party gray dependencies resolution

Dear Community,

We’re currently upgrading our plugins to Jira DC 10.3, for that we use the latest available Atlassian SDK 9.1.1 with AMPS version 9.1.3.
The re-occuring problem is the following: since Platform 7 introduced “gray” dependencies, which are no longer exported as OSGi services to external plugins, we end up getting the errors:

"Package XY is internal and is not available for export to plugin XY"

So one must compile the dependency into the plugin, but that fails when building on validating banned dependencies. The only workaround for this is to add banningExcludes to the AMPS configuration.

<banningExcludes>
	<exclude>com.google.code.gson:gson</exclude>
</banningExcludes>

Example: we would like to add custom JSON serializer/deserializers for date formats, for which either “com.fasterxml.jackson.datatype.jsr310” or “com.google.gson” is required.
Both of which are in the System bundle, neither of them is available for external plugins and both fail on validating banned dependencies.

[INFO] --- jira:9.1.3:validate-banned-dependencies (default-validate-banned-dependencies)
[INFO] validate banned dependencies
[INFO] Dependencies excluded from banning: []
[INFO] Platform version range: '[0,)'
[WARNING] Rule 0: org.apache.maven.plugins.enforcer.BannedDependencies failed with message:
make sure platform artifacts are not bundled into plugin
Found Banned Dependency: com.google.code.gson:gson:jar:2.11.0

This warns us not to bundle it into the plugin, but if it’s not provided, then there’s no other way. Is there really no nice way of achieving this other than compiling and explicitly adding it as a banning exclusion? For me, this seems unlogical.

2 Likes

I have the exact same situation, but with jackson-dataformat-yaml. If I mark it as provided i get:

...  Unresolved requirements: [[org.mitre.avsvsrp.plugin [260](R 260.0)] osgi.wiring.package; (osgi.wiring.package=com.fasterxml.jackson.dataformat.yaml)].  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

But if i make it compile, i get the build error:

... Found Banned Dependency: com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:jar:2.17.2

It is unclear how to work around this given that the other jackson packages seem to be available via provided, but not the one I actually need.

2 Likes

Hi, I am getting the same issue, upgrading our plugin from Jira version 9.17 to 10.3 and AMPS from 8.x to 9.x. Getting banned dependency if I try to compile gson, and osgi errors when I include it in Import-Package.
Has anybody found a solution for this?
Which amps / gson versions to use and how to configure it in the pom.xml?
Any help would be much appreciated!

@RoyHillel ,

The only current path i found to move past this was this comment:

When you have a legitimate reason for disabling this check, as in your situation, you can so do by adding this to your AMPS configuration:

<banningExcludes>
    <exclude>commons-io:commons-io</exclude>
    <exclude>com.foo:bar</exclude>
    ...
</banningExcludes>

But I’ll just reiterate that most AMPS users should not do this, they should use the dependencies that the platform provides.

Adding jackson-dataformat-yaml to the <banningExcludes> and excluding its transitive dependency on jackson-core in its <dependency> entry gets the project to compile and not mention:

... Package com.fasterxml.jackson.dataformat.yaml is internal and is not available for export to plugin org.mitre.avsvsrp.avsvsrp-plugin