New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cannot add a resolver from within a script #491
Comments
Having exactly the same issue. |
The problem here is that the resolvers only get added when the code executes, but the A workaround would be to put the resolver-mangling into a separate compilation block, using import ammonite._, Resolvers._
val oss = Resolver.Http(
"ambiata-oss",
"https://ambiata-oss.s3-ap-southeast-2.amazonaws.com",
IvyPattern,
false
)
interp.resolvers() = interp.resolvers() :+ oss
@
import $ivy.`com.ambiata::mundane:1.2.1-20141230225616-50fc792`
... Perhaps at some point we can add a magic |
cool, I didn't know about "compilation blocks"! |
@Eli-Golin, does the solution proposed by @lihaoyi work for you? |
sorry, haven't had time to look at this properly. I'm hoping that when @alexarchambault releases coursier 1.0.0 I can switch to it and all my ivy problems will magically go away... I don't actually know how ivy works |
Just a note that I'm having the same issue. Using |
Is there a fix for this? I have a dependency on the postgres jdbc jar, in https://maven.atlassian.com/3rdparty/ and while i can load this in the REPL, I can't work out how to add the resolver in a script to get it to work. |
A work-around is to manually load that dependency into your local maven cache: mvn dependency:get -DrepoUrl=https://maven.atlassian.com/3rdparty/ -DgroupId=postgresql -DartifactId=postgresql -Dversion=9.4.1208-jdbc42-atlassian-hosted |
…e defined in, rather than all up-front at the top. Fixes #491 Both the main running sequence as well as the data-format of the cached metadata need to be updated to interleave the processing of import hooks and user code
Should be fixed in daa4768 |
…e defined in, rather than all up-front at the top. Fixes #491 Both the main running sequence as well as the data-format of the cached metadata need to be updated to interleave the processing of import hooks and user code
cool! i see the fix is committed in the "test" branch. |
Come hang out in the gitter channel or follow me on twitter and you'll get pinged =) |
At some point, the Ammonite REPL will start pinging you about updated versions (#488) but that's for the future |
ok, thx! |
Cool! I confirm it works! |
This works good:
However, this fails:
For some reason,
interp.resolvers() = interp.resolvers() :+ oss
is not taken into accound when run from within a script.Note: I need this to create a script with the
#!/usr/bin/env amm
header.The text was updated successfully, but these errors were encountered: