Codearte / gradle-nexus-staging-plugin

Automatize releasing Gradle projects to Maven Central.
Apache License 2.0
172 stars 26 forks source link

Migrate HTTP client to okhttp. #188

Closed anuraaga closed 3 years ago

anuraaga commented 3 years ago

When I try to use this plugin with gradle-jib-plugin, I get dependency conflicts due to the version of the Apache HTTP client. I tried several attempts to constrain versions to get something to work but couldn't. https://github.com/jgritman/httpbuilder hasn't been updated for 7 years so it's probably good to migrate off of it. I went with okhttp which is a very popular HTTP client.

I haven't gotten to e2e test this yet on my end but sending for initial check. Thank you!

Fixes #42

szpak commented 3 years ago

Increased connection timeout helped e2e-test and I'm willing to merged it, but the other thing came into my mind. OkHttp seemed to be rewritten to Kotlin on the way. We would mix 3 languages in the project :). Do you have experience with the Kotlin dependencies? Should Kotlin (or even OkHttp and Kotlin) be shadowed? Or it should not be a problem and it could leave as is to make it easier to just override OkHttp (if needed) in the future, without having to release the new version of GNSP?

anuraaga commented 3 years ago

@szpak That's an interesting point - okhttp 3.x is still a common dependency and pure Java which is why I use 3.x in most projects, but I picked 4.x here because Gradle mixes 3 languages already :) So Kotlin is already available for free I think and since it needs to be compatible for plugin authors anyways, I'm not too worried about shading. Shading okhttp is also an option, but in my experience they're great on not making backwards incompatible changes (I think they would change the package name when doing so) so I'd lean towards not worrying.

anuraaga commented 3 years ago

Hi @szpak - I just found https://github.com/gradle-nexus/publish-plugin which seems to be the successor this plugin, and is already using okhttp. Should we go ahead and drop this PR? Or happy to let it merge if it's useful to anyone. I'm going to go ahead and give that plugin a go :D

szpak commented 3 years ago

I'm happy that you proposed that change and I plan to merge it (soon) and release 0.40.0 right after that, probably the last release, unless there are some important bugs found. We created the new unified plugin to make it easier to release to Maven Central, which is important especially these days :).

After checking if the new version of that plugin works fine for you, feel free to switch to the new plugin :-)

szpak commented 3 years ago

okhttp 3.x is still a common dependency and pure Java which is why I use 3.x in most projects, but I picked 4.x here because Gradle mixes 3 languages already :)

Hopefully Gradle will not upgrade Kotlin to the incompatible version anytime soon :)

szpak commented 3 years ago

I've just released 0.30.0, please let me know if it works in your project, before migrating to gradle-nexus-publish-plugin :-).

Thanks for your contribution!