kscript: Unable to pull dependencies
I wrote a simple script with a simple dependency to ‘com.opencsv:opencsv:4.6’. I get the following error message:
[kscript] Resolving dependencies...
[kscript] Resolving com.opencsv:opencsv:4.6...[kscript] [ERROR] Failed while connecting to the server.
Check the connection (http/https, port, proxy, credentials, etc.) of your maven dependency locators.
If you suspect this is a bug, you can create an issue on https://github.com/holgerbrandl/kscript
[kscript] [ERROR] Exception: org.sonatype.aether.resolution.DependencyResolutionException:
failed to load 'com.opencsv:opencsv:jar:4.6 (runtime)' from
[
"maven (https://maven.<company>.net/content/groups/public, releases+snapshots) without authentication",
"maven (https://maven.<company>.net/content/groups/public, releases+snapshots) without authentication"
] into /Users/<my_user>/.m2/repository
Is it possible to have a clearer error message on what could be causing this, the repository urls work perfectly on maven and gradle, and I can’t seem to find a reason for kscript to fail on resolving the dependencies.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 1
- Comments: 22 (2 by maintainers)
At least the jitpack example from @mirceanis as well as the initial opencsv example by @andrealexandre work fine when using the new kotlin-scripting-based resolver which you can find/test in branch https://github.com/holgerbrandl/kscript/tree/fix239
I’m closing this ticket because it’s covering too many individual examples. Please submit the other examples (which may relate to entirely different root causes) as separate issues. Thank you for your understanding.
I had the same issue today with
//DEPS org.javamoney:moneta:1.3
! I am pretty sure it was on maven-central. At the end I have added another Maven Repository to make it work:@file:MavenRepository("releases", "https://bintray.com/javamoney/maven/")
It can be an annoying bug if you do not find a fallback repo.
+1 a better way to pull dependencies. I came here because I had this error:
The error was actually a transitive dependency requiring an additional repo:
But the error didn’t say anything about that.
I’m not sure if this can be fixed without a patch in
jcabi-aether
… Also, it looks likejcabi-eather
doesn’t play super well with Java 11 (#239). All in all, a better way to handle dependencies would be nice.For what it’s worth, the kotlin-main-kts resolver code is there:
https://github.com/JetBrains/kotlin/blob/master/libraries/tools/kotlin-main-kts/src/org/jetbrains/kotlin/mainKts/impl/ivy.kt
But it looks like it has even more limitations: https://youtrack.jetbrains.com/issue/KT-38212 https://youtrack.jetbrains.com/issue/KT-38006
So maybe Gradle is a good candidate… Or forking aether ? Or rewriting a new one ?
Great work. Fingers crossed that they patch it soon so that we can release a new version of kscript including the fix.
I managed to do some debugging and it lead me to post this issue: https://github.com/jcabi/jcabi-aether/issues/106
It may be too early to tell but it leads me to think it won’t be fixed there. Perhaps a new method of downloading the dependencies is worth investigating.
I’m ignorant when it comes to maven repos but from the looks of it it seems to boil down to a HTTP GET request. I’m sure I’m missing something but if I’m not it may not be very hard to replace. Any thoughts or suggestions?
+1 for a fix or workaround