This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-09-07
Channels
- # announcements (4)
- # babashka (59)
- # beginners (26)
- # calva (34)
- # clj-kondo (3)
- # cljs-dev (1)
- # clojure (77)
- # clojure-austin (4)
- # clojure-europe (20)
- # clojure-nl (2)
- # clojure-norway (11)
- # clojure-spec (3)
- # clojure-uk (4)
- # clojurescript (103)
- # community-development (2)
- # cursive (15)
- # datalevin (12)
- # datascript (38)
- # datomic (1)
- # deps-new (2)
- # events (3)
- # figwheel-main (6)
- # fulcro (9)
- # honeysql (12)
- # jobs (4)
- # juxt (18)
- # kaocha (19)
- # lsp (42)
- # missionary (2)
- # pathom (14)
- # polylith (6)
- # portal (6)
- # reagent (8)
- # reitit (4)
- # releases (2)
- # shadow-cljs (17)
- # testing (1)
- # tools-deps (50)
- # vim (46)
- # xtdb (12)
Hi! I want to add a path to the classpath, but only in a deps.edn :aliases
.
I want to use codox to generate documentation, but it's for a babashka
pod. And that code, with the docstrings, is not in the classpath because
it can't be compiled by the normal compilation process (it is embedded
in the code that is compiled with macros so it can be injected into
babashka via it's interface). Any ideas how to extend the classpath in
an alias? I have tried a bunch of things with no success.
@Crispin use :extra-paths
inside your alias to specify the extra directors
And perhaps show us exactly what you have tried and exactly how it failed?
it failed with
Could not generate clojure documentation for pod.epiccastle.bbssh.utils - root cause: java.io.FileNotFoundException Could not locate pod/epiccastle/bbssh/utils__init.class, pod/epiccastle/bbssh/utils.clj or pod/epiccastle/bbssh/utils.cljc on classpath.
java.io.FileNotFoundException: Could not locate pod/epiccastle/bbssh/utils__init.class, pod/epiccastle/bbssh/utils.clj or pod/epiccastle/bbssh/utils.cljc on classpath.
ah bugger, that adds the classpath allright, but now it fails because it cant compile (which is why it's not in the classpath to begin with)
If Codox loads the code to generate docs, it is a compiling it.
it now doesnt load (even though the classpath is added) because the code cant compile:
Caused by: java.lang.ClassNotFoundException: babashka.pods
at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:476)
at clojure.lang.DynamicClassLoader.findClass(DynamicClassLoader.java:69)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:589)
at clojure.lang.DynamicClassLoader.loadClass(DynamicClassLoader.java:77)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:398)
at clojure.lang.RT.classForName(RT.java:2209)
at clojure.lang.RT.classForNameNonLoading(RT.java:2222)
at clojure.lang.Compiler$HostExpr.maybeClass(Compiler.java:1041)
at clojure.lang.Compiler.macroexpand1(Compiler.java:7062)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:7110)
... 156 more
That says Babashka pods isn't on the classpath
So I expect you need to add that as :extra-deps
in that alias
(sorry, on phone)
and this code that I want codox to run over, is text files that get injected into the babashka context
Then you can't use it with Codox
Ask in #babashka?
I also might be able to do something hacky, like preprocess those source files to remove offending vars...
Or get Codox to run under bb
?😁
this feels like a very simple problem but I'm having trouble googling it. when I run clj -A:myalias
it's failing to compile some change I've made, but it doesn't produce an error, it just exits with a 1
error code. Is there some trick to getting the compiler to print the eval error?
depends, clojure itself (the clojure.main entry point) always produces some kind of error message, possibly just pointing you to a file that contains the full error message
if you aren't getting any error message at all then you may need to look at whatever that alias is actually launching (assuming it isn't just clojure.main), that might be swallowing any errors
additionally, when an issue report is vague, it is often good to revisit and verify the underlying assumptions in the report: how do you know it is failing to compile if it just exits without an error message?
if I remove the namespace I require
from the gen-class
'd namespace with -main
it works fine
that lets me start a repl and then manually require
that same ns
maybe I'll try to make an actually minimal testcase
it's actually two, both adding :extra-paths
and :extra-deps
I assume I'm doing something weird. I have an alias named nrepl
that adds nrepl to the deps and then includes a path with a user.clj
I don't think I'm doing aot, not for dev
good idea
yeah, without that user.clj I don't think it pulls in the offending namespace so it works fine
what's the accepted way of adding nrepl? I put this in my user.clj and it seemed so.. wrong:
(ns user (:require [proj.main :as main] [nrepl.server :as nrepl])) (defonce nrepl-server (nrepl/start-server)) (spit "./.nrepl-port" (:port nrepl-server)) (main/-main)
and what happens if you start your repl without the user.clj and load proj.main and call (proj.main/-main)
yeah, then I see the compile error when I (require 'proj.main)
oh, of course, user.clj is loaded so early it doesn't have all the error reporting stuff around it
ah I see
I suppose I should just make my user.clj more simple and have some go
function that actually runs my app
I was used to lein repl
doing everything for me
thank you for your help, that error reporting explanation makes sense
I just thought I might be missing some glaringly obvious flag on clj
or doing something silly