vendredi 8 novembre 2019

Why is the kotlin-reflect library not available from the jar I packaged?

I'm building a library written in Kotlin and packaging as a jar through Maven. In my pom I have a dependency on kotlin-reflect artifact. I'm able to compile and package successfully, but when I then try to utilize this jar within another project (i.e., a service) I get an error saying: "Kotlin reflection implementation is not found at runtime. Make sure you have kotlin-reflect.jar in the classpath". If I include the dependency in the pom of the service everything works, but I want the library jar itself to have that dependency already without consumers of the library having to add this dependency to their pom.xml.

I have tried changing the scope in the dependency from compile to runtime. I just don't understand why the kotlin-reflect wouldn't be getting packaged within the jar of the library.

<dependency>
  <groupId>org.jetbrains.kotlin</groupId>
  <artifactId>kotlin-reflect</artifactId>
  <version>1.3.50</version>
</dependency>

Error that occurs in the service:

Exception in thread "main" kotlin.jvm.KotlinReflectionNotSupportedError: Kotlin reflection implementation is not found at runtime. Make sure you have kotlin-reflect.jar in the classpath.





Aucun commentaire:

Enregistrer un commentaire