question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support local jar references in @file:DependsOn

See original GitHub issue

I’m struggling to understand how I’m supposed to get access to my local libraries in kscript. I have simple file :

#! /usr/bin/env kscript
import se.explodera.util.sql.OracleDBFileLoader
println("Hello.")

where the imported class can be found in a jar file on the environment classpath. But when I run the script I get the message

error: unresolved reference: se
import se.explodera.util.sql.OracleDBFileLoader

Do I really have to add my local jar file to a maven repository?

When I try to print the classpath from within my code it seems to be limited to kotlin-runner.jar. Is this by design, or am I doing something wrong?

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:24 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
holgerbrandlcommented, Feb 13, 2021

Indeed it’s suboptimal from a user experience perspective. I’ve changed the title to reflect the idea better. I guess it should be addressed eventually by either extending the existing DependsOn annotation or by adding a new one. PRs are welcome.

0reactions
aartiPlcommented, Nov 27, 2022

Great that you want to take on this task - I appreciate that!

src/test/kotlin/io/github/kscripting/kscript - here you can find unit tests. maybe e.g. recursive reading of jar/aar files can be tested here. /integration/kotlin/io/github/kscripting/kscript/integration - all the integration tests have its home in this directory; most probably those tests will be more important to fully test the feature.

Just prepare a first version of PR - I will have a look at it, and advice how to proceed if needed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Support local jar references in @file:DependsOn #302 - GitHub
I'm struggling to understand how I'm supposed to get access to my local libraries in kscript. I have simple file : #! /usr/bin/env...
Read more >
How to add local jar files to a Maven project? - Stack Overflow
The best option for having local JAR files as a dependency is to create a local Maven repository. Such a repository is nothing...
Read more >
Local JAR Files as Gradle Dependencies | Baeldung
Learn how we can add local JAR files to our Gradle dependencies. ... The canonical reference for building a production grade API with...
Read more >
Location-Independent Access to Resources
Localized resources are supported by the internationalization facilities. ... The ClassLoader methods search each directory, ZIP file, or JAR file entry in ...
Read more >
Kotlin with OpenCV 4.10 on macOS terminal - Support
kotlinc test-opencv.kt -classpath /usr/local/opt/opencv/share/java/opencv4/opencv-410.jar -include-runtime -d test-opencv.jar. I get the jar ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found