This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-10-20
Channels
- # announcements (10)
- # aws (4)
- # babashka (71)
- # beginners (30)
- # calva (61)
- # cherry (1)
- # cider (16)
- # clj-kondo (3)
- # clj-on-windows (4)
- # cljsrn (1)
- # clojure (28)
- # clojure-austin (2)
- # clojure-bay-area (1)
- # clojure-europe (45)
- # clojure-hungary (1)
- # clojure-nl (1)
- # clojure-norway (26)
- # clojure-sweden (14)
- # clojure-uk (11)
- # clojurescript (39)
- # core-async (3)
- # core-typed (11)
- # datomic (68)
- # fulcro (7)
- # keechma (1)
- # lsp (29)
- # malli (5)
- # off-topic (57)
- # other-languages (13)
- # pathom (4)
- # rdf (7)
- # reagent (7)
- # reitit (6)
- # releases (1)
- # schema (8)
- # shadow-cljs (86)
- # sql (22)
- # squint (1)
- # vim (8)
- # xtdb (12)
Hi!
I deleted ~/.m2
because some trouble with a java dependency, and now my babashka script fails with:
$ bb_http_server.clj || cat `which bb_http_server.clj`
----- Error --------------------------------------------------------------------
Type: java.nio.file.NoSuchFileException
Message: /home/teodorlu/.m2/repository/org/babashka/http-server/0.1.11/http-server-0.1.11.jar
Location: /home/teodorlu/.local/bin/bb_http_server.clj:7:1
Any advice on what I can do to get back into a working state? Is there a cache babashka uses somewhere that I can delete, perhaps?edit: i'm going to try change the script to a different version of babashka.http-server
, and see if that triggers a redownload.
-Sforce
, same as Clojure CLI. This problem has been posted a few messages back as well
Posting the original message here in a thread instead:
$ bb_http_server.clj || cat `which bb_http_server.clj`
----- Error --------------------------------------------------------------------
Type: java.nio.file.NoSuchFileException
Message: /home/teodorlu/.m2/repository/org/babashka/http-server/0.1.11/http-server-0.1.11.jar
Location: /home/teodorlu/.local/bin/bb_http_server.clj:7:1
----- Context ------------------------------------------------------------------
3: (require '[babashka.deps :as deps])
4: (deps/add-deps
5: '{:deps {org.babashka/http-server {:mvn/version "0.1.11"}}})
6:
7: (require '[babashka.http-server :as http-server])
^--- /home/teodorlu/.m2/repository/org/babashka/http-server/0.1.11/http-server-0.1.11.jar
8:
9: (apply http-server/-main *command-line-args*)
----- Stack trace --------------------------------------------------------------
sun.nio.fs.UnixFileAttributeViews/Basic - <built-in>
java.util.zip.ZipFile/Source - <built-in>
java.util.zip.ZipFile/CleanableResource - <built-in>
babashka.impl.classpath/path-from-jar - <built-in>
babashka.impl.classpath.Loader/fn--13316 - <built-in>
clojure.core/some - <built-in>
babashka.impl.classpath/source-for-namespace - <built-in>
babashka.main/exec/load-fn--31119 - <built-in>
user - /home/teodorlu/.local/bin/bb_http_server.clj:7:1
#!/usr/bin/env bb
(require '[babashka.deps :as deps])
(deps/add-deps
'{:deps {org.babashka/http-server {:mvn/version "0.1.11"}}})
(require '[babashka.http-server :as http-server])
(apply http-server/-main *command-line-args*)
Perhaps deps.clj could be more clever here and check that all directories exist on the classpath, to invalidate the cache. This should be a relatively fast operation and easy to do in Clojure (as opposed to bash?). Pinging @U064X3EF3 to see what he thinks of this.
Looks like I'm getting the same error with -Sforce
:
$ bb -Sforce .local/bin/bb_http_server.clj
----- Error --------------------------------------------------------------------
Type: java.nio.file.NoSuchFileException
Message: /home/teodorlu/.m2/repository/org/babashka/http-server/0.1.11/http-server-0.1.11.jar
Location: /home/teodorlu/.local/bin/bb_http_server.clj:7:1
@U3X7174KS This is because add-deps
which probably is used inside that script doesn't "obey" that flag
Deleted ~/.clojure/.cpcache
- and now everything is working. Thanks a lot @U04V15CAJ 🙌
This problem should never happen again https://github.com/borkdude/deps.clj/commit/c2cb64a60beae108913a8935908c3b259047059d
I’ve considered doing that classpath check but it is valid to have empty source dirs so it would need to be a bit nuanced (just looking at jars probably). I would not expect it to be a perf issue in bash (but that’s something to check)
Hah, I noticed that gitlibs are already covered by the manifests checks, so only checking jar files should be sufficient
That is, removing the gitlibs directory should already work today, without problems
ok, this should do it then: https://github.com/borkdude/deps.clj/blob/33e31d2f9daabadff979ae4d58d2911726c76d4c/src/borkdude/deps.clj#L602-L611
this is kind of a separate question, but is this really a "faithful port" if you add features before the upstream?
That's a good question, that's why I pinged you in this issue as I expected you would have feedback on this.
I think another edge case here is :local/root "foo.jar"
which should also not need a new classpath calculation if missing
I will take a look at it, maybe today or tomorrow, not sure yet
ok, reverted and waiting for upstream. https://github.com/borkdude/deps.clj/commit/30bd56472daba5661d4c3f549c2e6572caed57ae at least we got the edge cases more clearly
@U064X3EF3
I see you implemented the .jar checks so I'll go ahead and re-add the code I reverted
https://github.com/clojure/brew-install/commit/f791abf1d93563c1ed8f256830bd0bfc085fdd53
Have you thought about the :local/root "foo.jar"
case, which does allow missing jar files? It's a bit of a pathological case though, so maybe worth ignoring
Another minor issue: can you maybe change the default branch in that repo to 1.11.1? Then we can see the newest commits right away
As for the non-existing :local/root "foo.jar"
case. the tools jar could emit a
.cpcache/01E115B1798E23AB3AB6C356BCC88293.jars
file similar to .manifests
with only the existing jar files after the classpath was produced, so only that list would be checkedI think it’s right to error if any jar is missing
I’ll get the default branch switched
@U064X3EF3 It doesn't error, it just marks the classpath cache stale. So if there would be a library on the classpath with a :local/root "non-existing.jar"
this would always result in a stale classpath check, while no error would be happening similar to non-existing source dirs on the classpath
It should only be stale if it’s missing?
@U064X3EF3 What I'm saying is:
• you said it's ok when source dirs are missing
• it can also be the case that jar files are missing when people use :local/root "some-jar-file.jar"
- what's the difference between src and jar file - that might also be ok? why not?
• someone making a mistake in their library could cause end users to always have stale classpath checks with 1177 - it seems wrong that some library's mistake could cause slowness on end users' systems
The “someone” and “end user” here are the same person in the use case for local jars, which is for pulling local jars into your application for something like a database driver jar
I understand what you’re saying, don’t need an example
I just don’t think it’s an issue
OK. I see the program is erroring with a missing local/root jar, so that's covered then:
$ clj
Error building classpath. Manifest type not detected when finding deps for missing-jar/missing-jar in coordinate #:local{:root "/private/tmp/missing-jar/missing-jar.jar"}
Yeah, should be much less relevant
Use of RELEASE is maybe the biggest cause to need it after
Checking another corner case:
This isn't supported right? {:paths ["missing-jar.jar"]}
But could still trigger the edge case described above
It seems that isn't entirely far-fetched... https://grep.app/search?q=%3Apaths.%2A.jar&regexp=true&filter[path.pattern][0]=deps.edn
If this isn't supported, might want to check if all entries in :paths
are directories (if they exist) in tools.deps or still improve the stale check for missing jars?
I’m ok with doing less in the paths check, sometimes there are useful hacks there. The missing jar check error could probably be better
What is the proper way to share some variables among tasks with babashka in a bb.edn
? Sort of how one would define some shared vars at the top of a makefile
Alternatively you could make a bb/tasks.clj
file and require this in your tasks and put your constants etc in there
Hi there, when I build a uberscript
I receive a bunch of
[babashka] Ignoring expression while assembling uberscript: (ns lib.deployments.gobo (:require [acuity.core3.models.enum :as enum] [com.cohesic.acuity.core2.models.location :as nil] [com.cohesic.acuity.core2.models.patient-type :as nil] [com.cohesic.acuity.core2.models.priority :as nil] [com.cohesic.acuity.core2.models.study-type :as nil])) near /home/cokap/git/cohesic/acuity/scripting/scripts/bb/corrective-fixes/report-headers.clj:7:77
[babashka] Ignoring read error while assembling uberscript near /home/cokap/git/cohesic/acuity/scripting/scripts/bb/corrective-fixes/report-headers.clj:12:99
...
Do I need to worry? The script seems to work but I am curious about what is happening thereThose are warnings because those expressions could not successfully be analyzed, perhaps because of :as nil
?
ok, I have the following in the namespace referred in the first warning
[com.cohesic.acuity.core2.models.location :as-alias model.location]
(and similar others)
ok will do that
I created this one
https://github.com/arichiardi/babashka-repros
But I actually found the reason of the first issue - there was no namespace backing that alias
There are other warnings in there when you run bb build
See above message, bb build
no? wait a sec let me check
@U04V15CAJ apologies, for some reason it was not committed
I suspected as much :) Yes, it definitely has to do with :as-alias
, thanks for the repro
i am a little confused how to use babashka.cli with bb.edn tasks framework. I simply want to parse some command options and all my logic is in the bb.edn
file . Is that possible?
Yes. You can call (babashka.cli/parse-opts *command-line-args*)
of course, but there is also tasks integration:
https://book.babashka.org/#_exec