Home > Net >  How to let kotlin library support java project friendly
How to let kotlin library support java project friendly

Time:07-05

I create an kotlin library and published into maven central.

However, if this library is used by pure java project, user must add the dependency “kotlin-stdlib” explicitly.

It looks like that the “koitlin-stdlib” is automatically excluded from grade/maven dependency tree because it is treated as provided dependency.

How to resolve this problem?

CodePudding user response:

In gradle you can add

dependencies {
  implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
}

The generated pom.xml should contain this dependency.

See:

CodePudding user response:

I find the reason.

implemetation(kotlin("reflect"))

is not OK,

api(kotlin("reflect"))

must be used.

  • Related