JavaMoney / jsr354-ri

JSR 354 - Moneta: Reference Implementation
Other
344 stars 101 forks source link

Hard dependency on okhttp, osgi? #404

Closed hrstoyanov closed 9 months ago

hrstoyanov commented 10 months ago

If read the POM correctly moneta-core has hard (compile) dependency on okhttp? What is the reason for a this (java has its own Java http client API since Java 11). Also not sure why are Jakarta Annotations also used? Some OSGI?

keilw commented 9 months ago

Because Moneta is still backward-compatible with Java 8. Maybe 1.5.x could raise the bar to Java 11, but for now it's still Java 8.

Also the JDK HttpClient is less powerful than OkHttp, e.g. it just offers a single connectTimeout (https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpClient.Builder.html) and not multiple, similar to the old HTTPConnection. So while 1.5 using Jakarta EE 10 will mean, we also have to use Java 11 as the minimum JDK, we'll see, whether we switch to the JDK version already or deprecate some settings in the javamoney.properties first before making that switch.

Jakarta Annotations are used for the Priority of services.

hrstoyanov commented 9 months ago

Thanks, ok, I see the reasoning... Hard pass from me due to the above issue at this point, but if you want this library to be truly versatile and non-intrusive, please consider removing Jakarta EE requirements (so it is useful in Micronaut, Helidon SE, Spring) and prefer core Java SE over external libraries. Maybe a smaller core that can be useful by anyone, with Jakarta EE entanglements in a higher layer?

keilw commented 9 months ago

It's a standard library that was refactored from javax (just like JavaMoney) to jakarta, but it's a single standalone library, used by pretty much all the mentioned frameworks anyway (https://mvnrepository.com/artifact/jakarta.annotation/jakarta.annotation-api)

dstoch commented 1 day ago

While the dependency on jakarta.annotation-api is not very problematic, the dependency on okhttp is (these libraries do not have versions as OSGi bundles). Why the need to introduce this dependency from version 1.4.3, it was not there before? Is it necessary to work always, or only for certain selected functions of moneta-core and could it be optional (Import-package optional)?

I cannot reopen this issue, should I create a new one for this problem?