okhttp: okhttp:5.0.0-alpha.10 can run into `java.lang.ClassNotFoundException: kotlin.time.DurationUnit`
See previous discussions in https://github.com/square/okhttp/pull/7267, https://github.com/square/okhttp/pull/7329, and https://github.com/square/okhttp/pull/7343. This is a continuation of that thread of problems, trying to iron out issues when using okhttp in a gradle plugin where the runtime kotlin version is restricted to 1.5.
Now I have put together a minimal standalone reproduction of the problem. It can be found at https://github.com/staktrace/20220627-okhttp-durationunit/tree/57afefa7bbe4f1cf1ae0b1dd8b6d4e01c4b738ff. To reproduce, clone the repo and run the ./reproduce.sh
script. The setup is that there are two separate gradle projects - one is a plugin that uses okhttp, and the other is a consumer that uses the plugin.
Some things I discovered along the way of creating this reproducer:
- If the plugin lives in the
buildSrc
folder of the consumer project, the problem doesn’t reproduce - The
kotlin-dsl
plugin being applied is important since it seems to be the thing that actually pins the gradle version to 1.5.31.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 15 (4 by maintainers)
I know OkHttp already understands Android vs JVM platforms, but doing so for a build system seems a step too far.
I also confirmed that the original problem I was seeing goes away with gradle 7.5. So 👍 from me for reverting all the things.
@martinbonnin sounds like you agree we can revert the existing attempts and ask people to upgrade to 7.5?