kotlin-jupyter
kotlin-jupyter copied to clipboard
How to add dependencies from a kotlin project?
How do I make it so that the Kotlin notebook gets all the dependencies that are defined in my build.gradle.kts file?
I have a simple Kotlin project with a build.gradle.kts that looks like this:
plugins {
kotlin("jvm") version "1.7.21"
application
//id("org.jetbrains.kotlin.jupyter.api") version "0.11.0-349"
kotlin("jupyter.api") version "0.11.0-349"
}
group = "org.example"
version = "1.0-SNAPSHOT"
repositories {
mavenCentral()
maven(url = "https://repo.kotlin.link")
}
dependencies {
implementation("commons-io:commons-io:2.11.0")
testImplementation(kotlin("test"))
}
tasks.test {
useJUnitPlatform()
}
tasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = "1.8"
}
application {
mainClass.set("MainKt")
}
As you can see, I've added commons-io as a dependency in my project.
I was trying to see if I could use commons-io in a kotlin notebook that I created inside this project but I keep getting Unresolved reference: "FileUtils" when I try to use commons-io
in kotlin notebook.
How do I do this? Is there an example project with kotlin notebook gettings it dependencies from the project?
Hello and welcome! It seems to be an issue of the previous version of Kotlin Notebook plugin. I've published Nightly version here: https://kotlinlang.slack.com/archives/C05333T208Y/p1681398267159449?thread_ts=1681393072.566159&cid=C05333T208Y
Bug should be fixed there. Do you have an access to the Kotlin Slack? If not, I'll send you link and instructions directly. Alternatively, you can wait a week (for 2023.1.1-RC) or two (for 2023.1.1 release) to get this thing working.
For further issues specific to Kotlin Notebook plugin, please use our YouTrack: https://youtrack.jetbrains.com/issues/KTNB