How to use a 3rd party maven dependency?

I added a dependency for OkHttp

        <dependency>
            <groupId>com.squareup.okhttp3</groupId>
            <artifactId>okhttp</artifactId>
            <version>4.8.1</version>
        </dependency>

and I get error and the plugin can’t be loaded when I do atlas-run

Caused by: org.osgi.framework.BundleException: Unresolved constraint in bundle com.mydomain.jira.plugins.assistant [180]: Unable to resolve 180.0: missing requirement [180.0] osgi.wiring.package; (osgi.wiring.package=android.net.http)

Any idea what’s going on and how can I add external dependencies?

Thanks.

More than likely there are osgi instructions in that library that Jira/Plugin Spring Scanner is picking up on. There are ways to exclude things (see Optional extended config - includeExclude, scannedDependencies at https://bitbucket.org/atlassian/atlassian-spring-scanner/src/master/ ). But in general it’s probably best to find a different library - depending on what the osgi dependencies are for - you’re going to be banging your head against the monitor for a bit).

I need a HTTP client library to be able to make some HTTP calls. I think there’s not many I can choose from, there’s OkHttp which seems very nice to use, and there’s Apache Http Client one.
I can try to use that instead, but would’ve preferred OkHttp one if possible since it’s nicer to use.

Take a look at SAL’s http client since it has atlassian endorsed time outs: https://developer.atlassian.com/server/framework/atlassian-sdk/sal-services/

I’ve used this and it works. Thanks.