a while back i wrote a library to learn kotlin. wh...
# getting-started
d
a while back i wrote a library to learn kotlin. when i try to use it in another project, it throws
java.lang.NoClassDefFoundError: com/beust/klaxon/Parser
on this line: https://github.com/danneu/reddit/blob/master/src/main/kotlin/com/danneu/reddit/extensions.kt#L44 i'm not very experienced in java/kotlin, any pointers on what might cause this when using a library from another project?
i
danneu: Just a guess, do you use IDEA <= 2016.3 and run the application from there? In that case dependencies might get incorrect scope when gradle project is imported.
Anyway, you should check whether the runtime classpath contains the library, where
com/beust/klaxon/Parser
comes from
d
@ilya.gorbunov i'm running it from 2017.1.2. i got the project to run by adding the same version
com.beust.klaxon
as a dependency to my child project which is something i wouldn't want library consumers to have to do
i
I've checked the generated pom file https://jitpack.io/com/github/danneu/reddit/0.0.1/reddit-0.0.1.pom and it seems to contain a valid
compile
dependency on that library. So if you consume your reddit library it should have klaxon as a transitive dependency downloaded.
d
@ilya.gorbunov that would mean that the project that uses my lib shouldn't have to explicitly import a dependency my lib already has, right?
i
right
Assuming that project uses maven or gradle to fetch your library and its dependencies
d
i republished my library and it seems to work without the previous error.