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.