good afternoon!! i have a `.main.kts` script, whe...
# scripting
g
good afternoon!! i have a
.main.kts
script, where i would like to use a local jar directly from my maven local without using
-cp
option at compile time.. something using
@file:Repository("path/to/mavenlocal")
and then
@file:DependsOn("groupId:artifactId:version")
i’m using the version 1.3.61 😕 any idea??
even an ivy local repo will be okay
i
Local ivy cache (~/.ivy2/cache) should work out of box.
@Repository
with directory name are supported, but treated as a base dir for the
@DependsOn
with a file name instead of the maven coordinates. And finally you may try to use
file:///<home>/.m2/repository
url the the
@Repository
parameter, maybe it will work as a local maven repo, I haven't tried it though.
g
linking a local .m2 repo as you described doesn’t work 😞 following the KEEP docs here https://github.com/Kotlin/KEEP/blob/master/proposals/scripting-support.md#script-evaluation (i know is not up to date) but it allows to link a jar directly, and before with kotlin 1.3.41 it was actually working.. now it raise this error:
Copy code
Unrecognized set of arguments to ivy resolver: file///path/to/myjar.jar (java.lang.IllegalStateException ...)
using this annotation, to be clear:
Copy code
@file:DependsOn("file:///path/to/myjar.jar")
i
I think that
Copy code
@file:Repository("/path/to/my")
@file:DependsOn("myjar.jar")
should work. We had some tests like this.
g
uh let me try now!! 😄
ok.. i make it working with absolute paths.. and without
file:///
like
@file:DependsOn("/absolute/path/to/myjar.jar")
but doesn’t work with relative paths.. like:
@file:DependsOn("./temp/myjar.jar)"
any idea where i’m wrong?
i
Do you have any
Copy code
@file:Repository("/path/to/my")
before
DependsOn
?
As far as I remember,
DependsOn
with files works only with relative paths, relative to the "repositories" added with
@Repository
annotations.
And I do not rermember any relevant changes before 1.3.70 (and even with 1.3.70 the behavior should be the same for this case.)
If it si not the case - I'll need to test myself, maybe there are some bugs here.
g
this means the path for the
Repository
must be absolute??
i
No, there is no restriction to the
@Repository
parameter.