This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-04-06
Channels
- # announcements (33)
- # babashka (13)
- # babashka-sci-dev (23)
- # beginners (94)
- # calva (105)
- # cider (37)
- # circleci (1)
- # clj-kondo (45)
- # cljs-dev (59)
- # cljsrn (2)
- # clojure (145)
- # clojure-czech (1)
- # clojure-europe (19)
- # clojure-nl (18)
- # clojure-norway (13)
- # clojure-portugal (1)
- # clojure-uk (5)
- # clojurescript (19)
- # community-development (2)
- # conjure (3)
- # copenhagen-clojurians (1)
- # core-async (34)
- # data-science (6)
- # datomic (25)
- # emacs (43)
- # fulcro (19)
- # graalvm (7)
- # graalvm-mobile (12)
- # graphql (10)
- # honeysql (3)
- # hyperfiddle (3)
- # improve-getting-started (2)
- # interop (20)
- # kaocha (3)
- # lsp (16)
- # meander (7)
- # off-topic (22)
- # other-languages (14)
- # portal (15)
- # releases (1)
- # rewrite-clj (2)
- # ring (1)
- # shadow-cljs (119)
- # spacemacs (19)
- # sql (65)
- # testing (4)
- # tools-deps (11)
- # xtdb (29)
if it doesn't cleanly fit into a keyword, symbol, or string - you can always use your own aggregate as a key
i wouldn't call this the most idiomatic thing in the world - but keywords and symbols are more for programatic identifiers and it sounds like your thing comes from outside data
and to be clear
{{:namespace "what is this"
:name "eeey"} 123}
Using maps as keys does workI've got a list of urls I need to do some processing on: basically initiate a GET and do some processing on the response, and finally serializing $stuff to sqlite. How do I want to do this in clojure? Should I map the list into a series of future
objects that I then wait on? Should I investigate core.async for something like this?
futures are backed by a "cached thread pool", so if you kick off a bunch of get requests all at once you will get exactly that many threads
which may or may not be okay, but i would use https://github.com/clj-commons/claypoole with your own executor
I was looking into the repo https://github.com/nberger/ring-logger , can we also add response data in the log ?
Might not be understanding the question, but this seems to be what the wrap-log-response
-function is for 😊
@UDB2Q0W13, I meant if my api is returning {:a "message"}
does we get the response in the logs?
Aha, I looked at the source code and it looks like only the response status gets logged 😢
I'm trying to use a 3'rd-party .jar file in a deps.edn project. I've put the jar file in a folder local to my project and pointed to it in the :deps section of my deps.edn file using a :local/root directive as shown in the "Include a local jar on disk" section of the "Deps and CLI Guide" document. However, I'm getting an error:
Error building classpath. Manifest type not detected when finding deps for <library> in coordinate #:local{:root <path-to-jar>}
Why is this error being thrown and what do I do about it? The "Deps and CLI Guide" doesn't mention anything about a manifest in the section on including the jar file.Doesn’t the jar file itself need to contain a manifest? (See https://docs.oracle.com/javase/7/docs/technotes/guides/jar/jar.html).
Are you sure that it does?
Which is confusing because jars also can a manifest file which is something else entirely
I don't entirely recall under what circumstances tools.deps requires a pom or dep.edn file, but I would not expect it to require one in that case
Is that 3rd party JAR file publicly accessible so we can double-check what is in it? And, yes, what does clojure -version
say, and perhaps also share your whole deps.edn
file if you can. More information will make it easier for us to help you @U0DTU8J83
I suspect the error means no pom.xml was found in the jar file (which is used for finding transitive deps)
possibly that is required when it should not be
I'm a little curious if that is the actual error as that implies you actually have "path-to-jar" in your deps (not sure if that was a concealing edit)
yeah, this doesn't seem to be an issue
% jar cf foo.jar README.md
% clj -Sdeps '{:deps {foo/bar {:local/root "foo.jar"}}}' -Stree
org.clojure/clojure 1.11.1
. org.clojure/spec.alpha 0.3.218
. org.clojure/core.specs.alpha 0.2.62
foo/bar /Users/alex.miller/code/foo.jar
seems fine to not have a pom.xml in the jar
An issue i’ve had in the past doing this is i would put the path to the folder containing the jar rather than the path to the jar itself. ie /Users/dan/stuff/
instead of /Users/dan/stuff/library.jar
. If that’s perhaps your issue
the error at the top implies the actual deps.edn has "<path-to-jar>" in it (that's not in any error message)
I think its consistent with i’ve written here:
clj -Sdeps '{:deps {metabase/metabase {:local/root "/Users/dan/projects/work/jars"}}}'
Error building classpath. Manifest type not detected when finding deps for metabase/metabase in coordinate #:local{:root "/Users/dan/projects/work/jars"}
If you put a path to a jar and forget to include the jar name you receive exactly that error. I have 10 jars in that directory but i’ve done this in the past when i downloaded a jar and wrongly thought i had to point at the folder containing the jar rather than the jar itselfagreed and that is common, but I don't think that's the issue here
but until the OP clarifies, can't tell
Sorry it's taken a while to get back to you. Here's my deps.edn:
{:paths
["src"]
:deps
{org.clojure/clojure {:mvn/version "1.10.3"}
compojure/compojure {:mvn/version "1.6.2"}
http-kit/http-kit {:mvn/version "2.5.3"}
ring/ring-json {:mvn/version "0.5.1"}
ring-cors/ring-cors {:mvn/version "0.1.13"}
org.clojure/data.json {:mvn/version "2.4.0"}
mercator/mapper {:local/root "../mercator"}
mercator/expander {:local/root "../mercator"}
mercator/primitives {:local/root "../mercator"}
mercator/templates {:local/root "../mercator"}
cheshire/cheshire {:mvn/version "5.0.2"}
;; The one below is the one that's giving me an issue...
apelon-dts/dtscore {:local/root "resources/jars/apelon"}}
:jvm-opts ["-XX:-OmitStackTraceInFastThrow"]
:aliases {;; build an uberjar (application) with AOT compilation by default:
:dev {}
:uberjar {:replace-deps {com.github.seancorfield/depstar {:mvn/version "2.1.303"}}
:exec-fn hf.depstar/uberjar
:exec-args {:aot true}}
;; build a jar (library):
:jar {:replace-deps {com.github.seancorfield/depstar {:mvn/version "2.1.303"}}
:exec-fn hf.depstar/jar
:exec-args {}}}}
{:local/root "resources/jars/apelon"}
doesn’t seem to be a path to a jar but a path to a folder that may or may not contain a jar?
The jar file has a pom.xml in its maven directory and has a MANIFEST.MF file in the META-INF directory.
The full error message I'm getting is:
Error building classpath. Manifest type not detected when finding deps for apelon-dts/dtscore in coordinate #:local{:root "C:\\Users\\fadrian\\Projects\\motive-cql-builder\\mercator-server\\resources\\jars\\apelon"}
OK. I've changed my :deps declaration for the .jar file to:
apelon-dts/dtscore {:local/root "resources/jars/apelon/dtscore-4.6.1-838.jar"}
I'm now getting the (slightly different) error message:
Error building classpath. Manifest type not detected when finding deps for apelon-dts/dtscore in coordinate #:local{:root "C:\\Users\\fadrian\\Projects\\motive-cql-builder\\mercator-server\\resources\\jars\\apelon\\dtscore-4.6.1-838.jar"}
The pom.xml file (to my limited experience) looks good and the groupId and artifactId all seem to match.
@U0DTU8J83 And is that full path correct? That's the correct path to that .jar
file?
Yes. The full path is correct. When going over the pom.xml files, there are some dependencies that are not in my :deps section. Would I need to add those?
What version of the Clojure CLI? clj --version
and inside the jar file, where is the pom? jar tf dtscore-4.6.1-838.jar | grep pom
is what I would do in *nix, not sure if you're on windows
I’ve tried to register 30 times at
to download their jar but cannot get it to accept a password through its verification 😞
it's going to look for something under META-INF/ that ends in pom.xml
Not certain about the version... How can I tell? pom.xml is found in META-INF/maven/apelon-dts/dtscore/pom.xml inside the .jar file.
clj --version
can you drop me the jar file somehow?
that all seems like it should be ok
well I don't see the problem you see, but I do see others
do you have anything configured in your ~/.m2/settings.xml
I can see many ways this can be problematic but not getting exactly the same errors - there are some system deps declared in the internal pom that point to hardcoded paths on your system. those fail for me, but that should be downstream from the error you're seeing, so I don't understand that. a workaround for this issue would be to instead include this as a path which will put it on the classpath without trying to understand it's deps:
{:paths ["src" "resources/jars/apelon/dtscore-4.6.1-838.jar"]
and then remove it from :deps
could also be a windows thing I guess
do you have a resources/jars/apelon/project/pom.xml or something like that?
It turns out your suggestion of adding the file to the src paths went farther, but then crashed with an error message:
ERROR: Unhandled REPL handler exception processing message {:op eval, :code *ns*, :id 1}
<stack trace>
Caused by: java.nio.file.NoSuchFileException: c:\Users\fadrian\Projects\motive-cql-builder\mercator-server\resources\jars\apelon\dtscore-4.6.1-838.jar
<more stack trace>
This is even when I'm looking directly at the .jar file mentioned in the file manager. I'll look into more tomorrow.That looks like something failed well beyond, could tell from the stack trace
Anyhow, I think something else is needed here from a feature level and I'll log something about that
According to the stack trace, it's throwing the exception when it's trying to read some file attributes for/within the .jar:
Caused by: java.nio.file.NoSuchFileException: c:\Users\fadrian\Projects\motive-cql-builder\mercator-server\resources\jars\apelon\dtscore-4.6.1-838.jar
at java.base/sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:85)
at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:103)
at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:108)
at java.base/sun.nio.fs.WindowsFileAttributeViews$Basic.readAttributes(WindowsFileAttributeViews.java:53)
at java.base/sun.nio.fs.WindowsFileAttributeViews$Basic.readAttributes(WindowsFileAttributeViews.java:38)
at java.base/sun.nio.fs.WindowsFileSystemProvider.readAttributes(WindowsFileSystemProvider.java:199)
at java.base/java.nio.file.Files.readAttributes(Files.java:1851)
at java.base/java.util.zip.ZipFile$Source.get(ZipFile.java:1264)
at java.base/java.util.zip.ZipFile$CleanableResource.<init>(ZipFile.java:709)
at java.base/java.util.zip.ZipFile.<init>(ZipFile.java:243)
at java.base/java.util.zip.ZipFile.<init>(ZipFile.java:172)
at java.base/java.util.jar.JarFile.<init>(JarFile.java:347)
at java.base/java.util.jar.JarFile.<init>(JarFile.java:318)
at java.base/java.util.jar.JarFile.<init>(JarFile.java:284)
at cider.nrepl.middleware.track_state$fn__3870.invokeStatic(track_state.clj:155)
at cider.nrepl.middleware.track_state$fn__3870.invoke(track_state.clj:155)
at clojure.core$map$fn__5884.invoke(core.clj:2759)
at clojure.lang.LazySeq.sval(LazySeq.java:42)
at clojure.lang.LazySeq.seq(LazySeq.java:51)
at clojure.lang.RT.seq(RT.java:535)
at clojure.core$seq__5419.invokeStatic(core.clj:139)
at clojure.core$map$fn__5884.invoke(core.clj:2750)
at clojure.lang.LazySeq.sval(LazySeq.java:42)
at clojure.lang.LazySeq.seq(LazySeq.java:51)
at clojure.lang.RT.seq(RT.java:535)
at clojure.core$seq__5419.invokeStatic(core.clj:139)
at clojure.core$apply.invokeStatic(core.clj:662)
at clojure.core$mapcat.invokeStatic(core.clj:2787)
at clojure.core$mapcat.doInvoke(core.clj:2787)
at clojure.lang.RestFn.applyTo(RestFn.java:139)
at clojure.lang.Compiler$InvokeExpr.eval(Compiler.java:3706)
... 68 more
That is coming from CIDER/nREPL -- so you're well past the Clojure CLI and deps.edn
issue. Maybe you can go ask in #cider? It might be Windows a path/escape issue in the nREPL middleware?
(posting here as well). I'd urge you to get a repl up without any extra tooling before figuring out what is going on in CIDER and Calva. I think Calva on windows uses a reproduction of the clojure cli and not the actual cli. Further, CIDER's tooling might have a bug, or might be hitting an issue related to this jar. It was far better to get a repl using just clojure
or clj
command line tools and then proceed to editor integrated tooling
Why not installing the jar file locally, and then using it in the project.clj or deps directly?
mvn install:install-file –Dfile=C:\dev\app.jar -DgroupId=com.roufid.tutorials -DartifactId=example-app -Dversion=1.0
A question from a coworker recently who is on the frontend (js) side and wants to learn from a good codebase: > A side topic: is this considered a good code base to learn if one wants to understand how to write a small, pure Clojure library written in idiomatic Clojure? Would appreciate if anything comes to mind
I asked something like this couple weeks ago and they send a few suggestions. I like the code of https://github.com/metabase/metabase.
heh. We work there and he is looking for something a bit smaller in scope that is “good code” for learning the language more than learning how to make a proper full product
Instaparse comes to mind: https://github.com/Engelberg/instaparse
almost too abstract. that would be handy idioms rather than library code that accomplishes something
after doing Clojure for a year that library is lovely. But before some experience it would just feel like koans i suspect
@U11BV7MTK x-posting from https://clojurians.slack.com/archives/C0353589RFC/p1649303391544799?thread_ts=1649278657.145889&cid=C0353589RFC. I think it will be useful to explain: • Choosing a project to read • Effective way(s) to read it • Suggested projects with short reasons why to read I tried to do a bit https://clojurians.slack.com/archives/C053AK3F9/p1638169591411900?thread_ts=1638165337.408400&cid=C053AK3F9, and in a meetup talk (https://github.com/adityaathalye/slideware/blob/master/Grokking%20Libraries%20in%20Clojureland.pdf).
https://github.com/cgrand/seqexp/blob/master/src/net/cgrand/seqexp.clj 220 LoC!
https://github.com/brandonbloom/fipp Another good choice for a small "does one thing well" library
Hey I'm trying to learn how to use clj
and I am trying clj -M:dev -M:repl
and I'm getting
WARNING: Specified aliases are undeclared and are not being used: [:dev]
Execution error (FileNotFoundException) at java.io.FileInputStream/open0 (FileInputStream.java:-2).
-M:repl (No such file or directory)
I'm new to using clj, do I need to update it or anything?Why am I getting this error & how do I fix it?
clj -M:dev:repl
everything after -M is treated as an argument passed to the main
Awesome thank you! It worked