Skip to content

Commit 81d4678

Browse files
committed
Make JSON imports optional in OSGi environments
When deploying in OSGi containers the Jedis bundle has two hard requirements on having the GSON and JSON bundles around. Since these depenendencies are optional we mark the imports as such in the OSGi manifest. If these packages are not exported the bundle will be installed and will be unable to make use of the JSON functionality. When they are present they will be used. Additionally, allow newer version of the org.json bundle to be used without requiring a new release of Jedis.
1 parent 251831c commit 81d4678

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

pom.xml

+13
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,19 @@
292292
<groupId>org.apache.felix</groupId>
293293
<artifactId>maven-bundle-plugin</artifactId>
294294
<version>5.1.9</version>
295+
<configuration>
296+
<instructions>
297+
<!--
298+
Ensure JSON dependencies are not required at run-time in OSGi environments and also
299+
allow usage of newer org.json versions.
300+
-->
301+
<Import-Package>
302+
com.google.gson;resolution:=optional,
303+
org.json;resolution:=optional;version="20240303.0",
304+
*
305+
</Import-Package>
306+
</instructions>
307+
</configuration>
295308
<executions>
296309
<execution>
297310
<id>bundle-manifest</id>

0 commit comments

Comments
 (0)