hi, a colleague of mine is not able to get any aliases working for clj, clj repl works fine, this is the error report -
{:clojure.main/message
"Execution error (FileNotFoundException) at java.io.FileInputStream/open0 (FileInputStream.java:-2).\n-X:test (No such file or directory)\n",
:clojure.main/triage
{:clojure.error/class java.io.FileNotFoundException,
:clojure.error/line -2,
:clojure.error/cause "-X:test (No such file or directory)",
:clojure.error/symbol java.io.FileInputStream/open0,
:clojure.error/source "FileInputStream.java",
:clojure.error/phase :execution},
:clojure.main/trace
{:via
[{:type java.io.FileNotFoundException,
:message "-X:test (No such file or directory)",
:at [java.io.FileInputStream open0 "FileInputStream.java" -2]}],
:trace
[[java.io.FileInputStream open0 "FileInputStream.java" -2]
[java.io.FileInputStream open "FileInputStream.java" 195]
[java.io.FileInputStream <init> "FileInputStream.java" 138]
[java.io.FileInputStream <init> "FileInputStream.java" 93]
[clojure.lang.Compiler loadFile "Compiler.java" 7571]
[clojure.main$load_script invokeStatic "main.clj" 475]
[clojure.main$script_opt invokeStatic "main.clj" 535]
[clojure.main$script_opt invoke "main.clj" 530]
[clojure.main$main invokeStatic "main.clj" 664]
[clojure.main$main doInvoke "main.clj" 616]
[clojure.lang.RestFn applyTo "RestFn.java" 137]
[clojure.lang.Var applyTo "Var.java" 705]
[clojure.main main "main.java" 40]],
:cause "-X:test (No such file or directory)"}}
My guess is the clj your colleague has is either a old version without -X support, or is not the tools.deps clj script
Calling it with -Sdescribe
will tell you which
If you get a similar looking error to the above then it is not the tools.deps clj script, otherwise you will get output that tells you the version of the script
1. First of all, run clj -Sdescribe
and upgrade if you're using an old version of clojure
2. It seems like you're running the command in two lines:
clj
-X:test
Probably not related to the error but just use a single line
3. -X
runs a function. Is test a function? If not, and the test alias has a :main-opts
, you should be using the -M
(main) flag instead: clj -M:test
Hello! How do I use :git-url
with :tag
? The official docs
> Optional key :tag
is used only to indicate the semantics of the sha
is not very clear to me. Can I require a particular branch, or master, without hardcoding a sha? Thank you!
@holyjak :git/url
(with the slash) and I think you should run -Sresolve-tags
to fill in the SHA
Oh, this is now called: -X:deps git-resolve-tags
I wonder if this will preserve comments, etc in the deps.edn file :thinking_face:
thank you!
It won’t
It does not do anything, I get "No unresolved tags found." So how can I point the dep to "master" (and possibly get :sha
auto-updated)? 🙏
I am sorry, was that a response to me? What won't what?
Ah, you meant that comments will not be preserved in the file.
yes, that's what I meant
master isn't a tag right?
correct, it's a branch
you're basically fighting what's provided now (which is intentionally narrowly scoped)
it would not be that hard to make something that updated the deps.edn to use the latest sha tracking a branch (tools.gitlibs in fact supports resolution of any rev, including branches)
I believe there is now a lib to update a deps.edn while preserving comments etc as well
There is nothing which can't be fixed with a lil' scripting and templating
This is one lib that can do it (based on rewrite-clj): https://github.com/borkdude/rewrite-edn
yeah, that + tools.gitlibs is about 95% of what you need
you could add a :branch to the git coord, it will just be ignored by tools.deps
(he says, without confirming :)
The approach that we are taking at work is having a deps.template.edn which we manipulate using a script which produces the final deps.edn. So comments are only preserved in the template, the deps.edn itself is just a pretty printed thing. You could just do this using pure git and no tools.deps even.
using tools.gitlibs will benefit you as it will cache the git dir and working tree shas in the same place and way as you'll get using them through tools.deps/clj
Getting the latest SHA doesn't require you to fetch the whole tree I think?
it won't
I see, so branches do not work. I have pushed a tag, v1, and tried
{:git/url "<https://github.com/holyjak/fulcro-troubleshooting>"
:sha "fake"
:tag "v1"}
but still it does not do anything.you can answer that from the git object dir, which is maintained independently from the sha working trees
did you push tags?
they are not pushed by default
yes, I did, and can see it in GH.
hm, maybe I should check if I have latest CLI ...
try it without :sha "fake"
I think it may not resolve the tag if it has a sha
spot on! Thanks a lot!
@holyjak FYI, this shows how to resolve master
to a SHA: https://github.com/seancorfield/dot-clojure/blob/develop/deps.edn#L207-L211
that seems like a bug, will fix it
(if you ignore the add-libs aspect of it -- I'm just talking about the gitlibs
part)