-
Any tips how to add Unirest-java as a dependency to jira plugin / app? My guess is that in osgi world wrong class loader is used. I tried to "fix" this by using spi-fly but couldn't make it work (I guess spy-fly is not included intoOSGi Framework Jira initializes). |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
So I will start off saying that I have no idea how Jira plugins work and am only vaguely familiar with OSGi. The ServiceLoader is a old school java thing and it works by looking for a special file in the meta-resources of the jars for the Json libraries. like this one: https://github.com/Kong/unirest-java/blob/main/object-mapper-jackson/src/main/resources/META-INF/services/kong.unirest.core.json.JsonEngine Could it be that the resource file is not present in the however this is getting packaged? |
Beta Was this translation helpful? Give feedback.
-
Hrm , I have seen issues with ServiceLoader in some packaging systems before, so I've decided to introduce a couple new strategies to CoreFactory:
This is available in Unirest |
Beta Was this translation helpful? Give feedback.
Hrm , I have seen issues with ServiceLoader in some packaging systems before, so I've decided to introduce a couple new strategies to CoreFactory:
use the java.util.ServiceLoader to load a class by looking for a meta config file in the resources. They should exist at META-INF.services/kong.unirest.core.json.JsonEngine. The ServiceLoader will use the first one it finds. see https://docs.oracle.com/javase/8/docs/api/java/util/ServiceLoader.html
It will attempt to load the engine by class name from the classloader by known names in order. These are:
1.
kong.unirest.jackson.JacksonEngine
2.
kong.unirest.gson.GsonEngine
Clients may set a engine with the setEngine method like
CoreFactory.…