Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Embed dependencies brake Kotlin projects compilation #107

Open
dlecan opened this issue Apr 7, 2022 · 4 comments
Open

Embed dependencies brake Kotlin projects compilation #107

dlecan opened this issue Apr 7, 2022 · 4 comments

Comments

@dlecan
Copy link

dlecan commented Apr 7, 2022

Hello,

I wonder why the Kotlin runtime is packaged with this "fat" jar.
It leads to compilation errors:
w: Some JAR files in the classpath have the Kotlin Runtime library bundled into them. This may cause difficult to debug problems if there's a different version of the Kotlin Runtime library in the classpath. Consider removing these libraries from the classpath
Then it breaks compilation.

Look at the content of the jar:

https://repo1.maven.org/maven2/com/smartcar/sdk/java-sdk/3.2.1/java-sdk-3.2.1.jar

Content :

com/google/
com/google/gson/
com/google/gson/annotations/
com/google/gson/internal/
com/google/gson/internal/bind/
com/google/gson/internal/bind/util/
com/google/gson/internal/reflect/
com/google/gson/reflect/
com/google/gson/stream/
com/smartcar/
com/smartcar/sdk/
com/smartcar/sdk/data/
javax/
javax/json/
javax/json/spi/
javax/json/stream/
kotlin/
kotlin/annotation/
kotlin/annotation/annotation.kotlin_builtins
kotlin/collections/
kotlin/collections/builders/
kotlin/collections/collections.kotlin_builtins
kotlin/collections/unsigned/
kotlin/comparisons/
kotlin/concurrent/
kotlin/contracts/
kotlin/coroutines/
kotlin/coroutines/cancellation/
kotlin/coroutines/coroutines.kotlin_builtins
kotlin/coroutines/intrinsics/
kotlin/coroutines/jvm/
kotlin/coroutines/jvm/internal/
kotlin/experimental/
kotlin/internal/
kotlin/internal/internal.kotlin_builtins
kotlin/io/
kotlin/js/
kotlin/jvm/
kotlin/jvm/functions/
kotlin/jvm/internal/
kotlin/jvm/internal/markers/
kotlin/jvm/internal/unsafe/
kotlin/kotlin.kotlin_builtins
kotlin/math/
kotlin/native/
kotlin/native/concurrent/
kotlin/properties/
kotlin/random/
kotlin/ranges/
kotlin/ranges/ranges.kotlin_builtins
kotlin/reflect/
kotlin/reflect/reflect.kotlin_builtins
kotlin/sequences/
kotlin/system/
kotlin/text/
kotlin/time/
okhttp3/
okhttp3/internal/
okhttp3/internal/authenticator/
okhttp3/internal/cache/
okhttp3/internal/cache2/
okhttp3/internal/concurrent/
okhttp3/internal/connection/
okhttp3/internal/http/
okhttp3/internal/http1/
okhttp3/internal/http2/
okhttp3/internal/io/
okhttp3/internal/platform/
okhttp3/internal/platform/android/
okhttp3/internal/proxy/
okhttp3/internal/publicsuffix/
okhttp3/internal/publicsuffix/NOTICE
okhttp3/internal/publicsuffix/publicsuffixes.gz
okhttp3/internal/tls/
okhttp3/internal/ws/
okio/
okio/internal/
org/
org/apache/
org/apache/commons/
org/apache/commons/codec/
org/apache/commons/codec/binary/
org/apache/commons/codec/digest/
org/apache/commons/codec/language/
org/apache/commons/codec/language/bm/
org/apache/commons/codec/net/
org/apache/commons/lang3/
org/apache/commons/lang3/arch/
org/apache/commons/lang3/builder/
org/apache/commons/lang3/concurrent/
org/apache/commons/lang3/event/
org/apache/commons/lang3/exception/
org/apache/commons/lang3/math/
org/apache/commons/lang3/mutable/
org/apache/commons/lang3/reflect/
org/apache/commons/lang3/text/
org/apache/commons/lang3/text/translate/
org/apache/commons/lang3/time/
org/apache/commons/lang3/tuple/
org/apache/commons/text/
org/apache/commons/text/diff/
org/apache/commons/text/similarity/
org/apache/commons/text/translate/
org/glassfish/
org/glassfish/json/
org/glassfish/json/api/
org/glassfish/json/messages.properties
org/intellij/
org/intellij/lang/
org/intellij/lang/annotations/
org/jetbrains/
org/jetbrains/annotations/

Is it possible to download somewhere only the com.smartcar.* jar ?

@dlecan dlecan changed the title Why the Kotlin runtime is embeded with this SDK? Why the Kotlin runtime is embedded with this SDK? Apr 7, 2022
@dlecan
Copy link
Author

dlecan commented Apr 7, 2022

If I tried 3.1.1, it also breaks my application :-(
Useless

@gurpreetatwal
Copy link
Contributor

Hi @dlecan 👋

I ran gradle dependencies which shows that Kotlin is being bundled in by Okio which itself is bundled in by Okhttp. We can take a look at how to go about publishing a jar which just has the com.smartcar.* classes next week, but I'll be up front and state that I'm not too familiar with Java packaging. If you know how to achieve this feel free to push up a PR and we can review it.

compileClasspath - Compile classpath for source set 'main'.
+--- com.google.code.gson:gson:2.8.6
+--- com.squareup.okhttp3:okhttp:4.9.1
|    +--- com.squareup.okio:okio:2.8.0
|    |    +--- org.jetbrains.kotlin:kotlin-stdlib:1.4.0 -> 1.4.10
|    |    |    +--- org.jetbrains.kotlin:kotlin-stdlib-common:1.4.10
|    |    |    \--- org.jetbrains:annotations:13.0
|    |    \--- org.jetbrains.kotlin:kotlin-stdlib-common:1.4.0 -> 1.4.10
|    \--- org.jetbrains.kotlin:kotlin-stdlib:1.4.10 (*)
+--- commons-codec:commons-codec:1.10
+--- org.apache.commons:commons-text:1.2
|    \--- org.apache.commons:commons-lang3:3.7
\--- javax.json:javax.json-api:1.0

@dlecan
Copy link
Author

dlecan commented Apr 11, 2022

Was it intended to publish a fat jar?

This line is breaking everything:

configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }

@dlecan dlecan changed the title Why the Kotlin runtime is embedded with this SDK? Embed dependencies brake Kotlin projects compilation Apr 11, 2022
@davismariotti
Copy link

Is there any update on this? I can't upgrade past 3.1.0 as 3.1.1 breaks my build. I'm using kotlin 1.9.23 and it looks like there is a conflict there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants