In a Kotlin project with the gradle build, Is ther...
# announcements
s
In a Kotlin project with the gradle build, Is there a usecase to use a
java-library
plugin even though I already use kotlin gradle plugin?
m
Technically, it uses the java plugin, and not the java-library plugin. Also, implementation is the new compile. The java-library also adds the concept of api vs implementation for dependencies. An api dependency will become a transitive dependency for anything that depends on the library. An implementation dependency will be available for compiling the project, but it won't be included transitively by projects that depend on the library.
p
I think it does make sense for kotlin libraries (rather than apps). If I'm not mistaken,
java-library
depends on
java
anyways, so it's not a problem that
kotlin
also depends on
java
.
m
Yes, both java-library and kotlin 'extend' the java plugin. Internally, if it isn't already applied, then they will apply it. Just wanted to make the distinction that java-library is more than java, and Kotlin builds on the java, and not the java-library plugin.