Is it possible to import a class written inside a ...
# datascience
f
Is it possible to import a class written inside a Kotlin file in a Jupiter notebook? If so, how? Also, considering this class calls a JVM library.
i
If you have a directory containing compiled classes (like in classes directory after a project build), you may specify a path to this directory in DependsOn annotation, like it's done for other dependencies
👍 1
f
Now I can import the class I wrote but can not use it because of its dependencies. Then I imported the dependencies with maven @file:Repository()... But the error continues. So I can use the dependencies but not my custom class because the built folder does not contain a .class file for the dependencies
i
Sure, .class files know nothing about their dependencies. You may include these dependencies manually using DependsOn. But general way is to publish an artifact, i.e. to local Maven repository. Artifact consists not only of jar where class files are located but it also contains pom.xml where dependencies are described. Syntax for including artifacts from maven local is: @file:Repository ("*mavenLocal") @file:DependsOn ("groupartifactIDversion")