https://kotlinlang.org logo
Title
p

poohbar

01/23/2018, 2:00 PM
Is there a solid step by step guide on how to solve this build error?
Runtime JAR files in the classpath should have the same version.
For the life of me I can't find what's pulling in the wrong version of stdlib.
e

etibaldi

01/23/2018, 2:03 PM
try running the gradle "dependencies" task on your project and find where the two versions come from
p

poohbar

01/23/2018, 2:03 PM
I am using Maven and yeah running
dependency:analyze
did not really help me. It just says that the dependency is undeclared but somehow it's there.
e

etibaldi

01/23/2018, 2:05 PM
running
dependency:tree
?
p

poohbar

01/23/2018, 2:06 PM
no, running
dependency:analyze
but I will try
tree
found it, thanks!
the next question is, how do I get rid of it.. I need the dependency but it's pulling in an old version of kotlin
is there another option than adding
<exclusion>
?
i thought if I declare it specifically in my module it should take precedence over this.. well I declared it in the parent of this pom, but that should work too I thought
Fixed it! I had
stdlib-jre8
declared explicitely but I also had to declare
stdlib
. Now someone could explain to me how Kotlin is packaged and what does it mean to use
stdlib-jre8
vs
stdlib
d

dalexander

01/23/2018, 2:17 PM
I believe stdlib-jre8 is compiled with bytecode targeting Java 8 rather than Java 6.
i

ilya.gorbunov

01/23/2018, 3:01 PM
kotlin-stdlib-jre8
is an additional artifact for
kotlin-stdlib
with java 8 specific API. You need to have both in runtime if you want to use
kotlin-stdlib-jre8
. Usually
kotlin-stdlib
and
kotlin-stdlib-jre7
are pulled in as transitive dependencies of
kotlin-stdlib-jre8
d

dalexander

01/23/2018, 3:02 PM
Thanks for clarifying 🙂